Program 8 will be an interactive patient billing system program which will emphasize modularization, especially in the use of user-defined functions and procedures using variable parameters. You will also use a binary search algorithm to process two input text files. All I/O in this program will be via text files whose names are to appear in the constant section of the main program.
The input to the program will come from three text files.
The first input file (referred to as the "services file") contains on each line a 20-character service name, followed by one or more spaces and then an integer service code. This file is not sorted. A typical record in the services file could be:
Laryngoscopy 5
The second input file (referred to as the "new charges file") contains on each line of the file a 5-character patient identification number (ID) in columns 1-5, followed by one or more spaces and then an integer identifying the type of service received by the patient, followed by one or more spaces and then a real number giving the fee to be charged to that patient. This file is not sorted. The new charges file represents the data input at the console as each patient finishes their visit. A bill is generated from this information on the spot. A typical record in the new charges file could be:
12230 5 40.0
The third input file (referred to as the "patient master file") has on each line a patient ID in columns 1-5, the patient's name in columns 7-21 and then separated by one or more spaces, values for the following numerical quantities:
Insurer code (integer)
Year to date total fees charged (real)
Year to date total fees billed to insurance (real)
Year to date total fees billed to the patient (real)
Insurance coverage percentage (real, between 0 and 1 inclusive)
Total account balance (real, positive for an amount owed)
Thus a typical record in the patient master file could be:
12230 Edwin Burdek 8 300.00 210.00 90.00 0.70 45.00
The patient master file is sorted by patient ID in ascending order.
There may be patient records in one file whose patient ID is not matched by any patient ID in the other file. When run against these data files, your program will produce:
The Error Log file will have a header banner at the beginning of the file very much like the following:
=======================================
Error Log File
Date: <date Error Log file created; use TIMER07.PAS>
Time: <time Error Log file created; use TIMER07.PAS>
Input files:
<name of patient master file>
<name of new charges file>
<name of services file>
Programmed by: <your name here>
CS 171 - <your section here>
=======================================
Due Date: 5/17/2001
Value: 150 pts.
=======================================
The Statement File will have a very similar header banner at the
beginning of the file:
=======================================
Patient Statement File
Date: <date Statement file created; use TIMER07.PAS>
Time: <time Statement file created; use TIMER07.PAS>
Input files:
<name of patient master file>
<name of new charges file>
<name of services file>
Programmed by: <your name here>
CS 171 - <your section here>
=======================================
Due Date: 5/17/2001
Value: 100 pts.
=======================================
You are to create and use a procedure called Create_Banner to print
these banners in the output files. The lines of === should be
created by a nested procedure within Create_Banner called
Print_line; pass the character to print ( = ) and the number of
them to print as values to the procedure. Pass the different
messages "Error Log File" and "Patient Statement File" to the
procedure Create_Banner as appropriate.An entry (section) in the patient statement file will look like the following; compare to the entries given from the input files listed earlier (computations may not be exact):
============================================================
PATIENT INVOICE
Patient identification number: 12230
Patient name: Edwin Burdek
Insurer code: 8 Service: Laryngoscopy
Current Year to Date
Description Amount Amount
--------------------------------------------------
Amount charged 40.00 340.00
Billed to insurer 28.00 238.00
Billed to patient 12.00 102.00
Current charges 12.00
Previous balance 45.00
-------------------------------
Total Due (please pay) 57.00
============================================================
EXTRA CREDIT NOTICE: You may elect to add the following feature to
your program 8 code for 50 pts extra credit (and you must so note
in the banners written at the top of the Error and Statement log
files, see above): the order of the patients written in the
Statement Log must be alphabetized by patient last name. Do not
underestimate the demands of this additional feature! If you elect
to add it to Program 8, it is a good idea to plan for it from the
very beginning. You may NOT accomplish this by first sorting the new
charges file by last name!The following paragraphs explain how these amounts are computed on the basis of values read from the input files for the patient record being processed. Note: any dollar value computed as a product or quotient should be immediately rounded to the nearest cent by calling a function which returns its real argument rounded to two decimal places (use the reference sheet from Program 6).
The amount charged current amount is used directly as read from the charges file. The year to date amount charged is the sum of the current amount charged with the previous year to date total from the patient's record in the master file. The amount billed to the insurer is the product of the current amount charged and the insurance coverage percentage from the patient's record. The amount billed to the patient is the difference between the total charge and the amount billed to insurance. The corresponding year to date amounts are updated in the patient's record in the obvious way.
The charges shown on the invoice are merely a repeat of the current amount charged to the patient, thr prvious total balance, and the new total balance.
Statements are generated for all patients with valid new charges, even if the amount billed to the patient is zero. In this case the current amounts charged would simply be zero.
At the end of the Statement Log File is to appear a summary report in the following format (the data values shown are for illustration purposes only; the date following "Report Created on:" is supplied by TIMER07.PAS. Note also how the money amounts are formatted in the proper US style, but this is not required in the body of the Statement log; see the reference section of Program 6):
=============================================================== Report Created on: 5/17/2001 Total number of patients in this report: 21 Total of all current charges in this report: $4,947.95 Total of all totals due in this report: $5,843.85 =============================================================== End of ReportBuild this program in stages (see detailed time chart at the end of this handout):
You will be given two sets of input data files (PATIENT1.DAT together with CHARGES1.DAT and SERVS1.DAT, plus PATIENT2.DAT together with CHARGES2.DAT and SERVS2.DAT). They will be available sometime on or before Wednesday, May 9. One pair of files will contain no errant records, so should produce a "clean" Error Log file. The other pair of files will contain charge errors of both types and so your Error Log file will contain entries pointing out the problem records.
The only output to the user's screen in this program will be appropriate informational messages only as processing progresses.
Excellent documentation of all procedures, functions and the main code is expected in this program. Significant point deductions will be incurred by programs without appropriate documentation. Include in your main code prologue a table listing by name all procedures and functions used in your program along with a short phrase describing their purpose. Also, be sure each procedure and function has a (mini) prologue of its own.
TURN IN TO THE MCS OFFICE paper copies of the following (using your folder; include a disk with your program source code and copies of all input and output files):
There will be no "redos" on this program -- significant point deductions will accrue in lieu of a redo (i.e., an error causing a "redo" = 20% deduction).
Here is a possible work schedule for completing Program 8 correctly and on time (using a two week time line):
TASK/COMPLETION DATE
FAQs:
55555 5 40.0 Error in new charges file. No matching record in Patient Master File 11111 23 40.0 Error in new charges file. No matching service in Services File
![]() |
Return to CS-171 Home Page |
![]() |
Return to UW-W Home Page |
|