Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a program that computes and displays the charges for a patient's hospital stay. First, the program should ask if the patient was admitted as
Write a program that computes and displays the charges for a patient's hospital stay. First, the program should ask if the patient was admitted as in in-patient or an out-patient. The user can enter the letter i or I for in-patient, or the letter o or O for out-patient. Write a function called Menu, which takes no input parameters and returns a char value. Your main program will call this Menu function, which will prompt the user to enter the category ('ior ' for in-patient or 'o'or 'O' for in-patient) and return the char entered by the user to your main program. Next in the main program, use the switch statement to get additional information from the user and compute the charges If the patient was an in-patient, ask the user to enter the following information: The number of days spent in hospital The daly rate .costs for labs costs for medicine Do not accept negative numbers for any of the information Charges for in-patient days rate+cost of labs+ cost of medicine. Write a function called charges to calculate the charges due and call the function from your main program. This function should be overloaded with another function (see gray highlighted text below). This will be the one of the overloaded functions and it should accept arguments for the in-patient data. The function returns the total charges. If the patient was an out-patient, ask the user to enter the following information costs for labs costs for medicine Do not accept negative numbers for any of the information Charges for out-patient cost of labs+cost of medicine. Write a function called charges to calculate the charges and call the function from your main program. This function is overloaded with the charges function described above (see gray highlighted text above). While the function above accept arguments for the in-patient data,this overloaded function accepts arguments for out-patient data. The function returns the total charges BONUS POINTS: You will get bonus points if you write a function/s to read the information (days, rate, cost of labs, medicine) entered by the user
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started