Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Bilbo?s Hospital needs a program to print out patient bills. There are 2 categories of patients, in-patient and out-patient. The category will be indicated with

Bilbo?s Hospital needs a program to print out patient bills. There are 2 categories of patients, in-patient and out-patient. The category will be indicated with and 'I' or 'O'. In addition to the main program, you are to write 2 functions, one called InParI'eai/l and the other called OutPatienBill.

The main program begins by reading the patient ID number. Then read a single character
indicating in-patient or outpatient.

The ID number of in-patients begins with 1 through 5. Outpatients begin with 6 through 9. Use an if/else to validate the ID number with the patient type. Print the patient ID number
and an error message if they do not match correctly. Read the remaining information for the
patient type, but disregard it. The main program does all reading of data and all output.

If the patient type is an 'I? then 4 values are read: if an ?0' then 2 values are read. Check for both upper and lower case. Then the functions are called to make the calculations. Use a switch statement or if/else statement to distinguish between the '0' and ?I?.

For InPatientBill, the following information is required as parameters:
Number of Days spent in hospital
Daily Rate Charge
Charges for other hospital services (lobs tests, etc.)
Medications

For OutPatientBill, the following information is required as parameters:
Charges for hospital services (lab tests, etc.)
Medications

The functions are to calculate the total bill using the input parameters and return the final charge. The functions have NO NO statements.

InPotientBill calculates the charges by multiplying the number of days by the daily rate charge then adding in the other two parameter values. OutPatientBill calculates the charges by adding the 2 parameters plus a $10 processing fee to each bill.

The main program is to read data until the end of the file. A second data file will be provided next week. Run the program for the data below 6: for the next file and turn in both. ~ Get your program running with cin/cout then convert to file I/O. Create your own data file from the data below.

The patient bill MUST look as follows: Patient ID: 45812 Type: In-patient Total Due: $1477.20 3 Days @ Other $ $ Medicines $ Patient ID: 98982 Type: Out-patient Total Due: $ 673.80 Charges $ Medicines $ $ Processing $ Patient ID: 78789 345.90 200.00 239.50 459.90 203.90 10.00 Error ** Data file: 45812 47992 98982 76445 39873 29874 89745 78789 99999 10453 67381 HHOOH 29871 90378 87334 59993 46190 78222 33340 34887 68444 I I 3 10 459.9 2089.54 HHH I 2 O 543.9 0 987.43 I 7 250.05 I 345.90 368.9 I 543 O Hospital Data File 2 remove this line. 203.9 409 450,22 459.00 562.8 200 239.5 409.3 39 3 10 8 8731.9 81.99 349.22 451.88 399.3 549.9 574.99 3459.99 12 34592.3 4398 847.44 5 7485.33 894.22 93.00 485.99 578.3 345.99 2340. 34.0 900 959.5 483.91 453.23 849 84951.8 88.33 8493.90 345 3546.1 8.34

Step by Step Solution

3.39 Rating (158 Votes )

There are 3 Steps involved in it

Step: 1

include include include inclu... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

College Physics

Authors: Jerry D. Wilson, Anthony J. Buffa, Bo Lou

7th edition

9780321571113, 321601831, 978-0321601834

More Books

Students also viewed these Programming questions