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 an inpatient or an outpatient. If the patient was an inpatient, the following data should be entered: • The number of days spent in the hospital • The daily rate • Hospital medication charges • Charges for hospital services (lab tests, etc.) The program should ask for the following data if the patient was an outpatient: • Charges for hospital services (lab tests, etc.) • Hospital medication charges The program should use two overloaded functions to calculate the total charges. One of the functions should accept arguments for the inpatient data, while the other function accepts arguments for outpatient information. Both functions should return the total charges and display it for the user.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter9: Records (struct)
Section: Chapter Questions
Problem 2PE
icon
Related questions
Question
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 an inpatient or
an outpatient. If the patient was an inpatient, the following data should be
entered:
• The number of days spent in the hospital
• The daily rate
Hospital medication charges
• Charges for hospital services (lab tests, etc.)
The program should ask for the following data if the patient was an outpatient:
• Charges for hospital services (lab tests, etc.)
• Hospital medication charges
The program should use two overloaded functions to calculate the total charges.
One of the functions should accept arguments for the inpatient data, while the
other function accepts arguments for outpatient information. Both functions
should return the total charges and display it for the user.
After the total charges have been calculated and displayed, write the result to a
file, PatientReport.txt. You can use the techniques you learned in Chapter 5,
Section 5.11, Using Files for Data Storage.
Input Validation: Do not accept negative numbers for any data.
For this exercise, you do not need to upload the PatientReport.txt file. It will be
created when I run your program.
Transcribed Image Text: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 an inpatient or an outpatient. If the patient was an inpatient, the following data should be entered: • The number of days spent in the hospital • The daily rate Hospital medication charges • Charges for hospital services (lab tests, etc.) The program should ask for the following data if the patient was an outpatient: • Charges for hospital services (lab tests, etc.) • Hospital medication charges The program should use two overloaded functions to calculate the total charges. One of the functions should accept arguments for the inpatient data, while the other function accepts arguments for outpatient information. Both functions should return the total charges and display it for the user. After the total charges have been calculated and displayed, write the result to a file, PatientReport.txt. You can use the techniques you learned in Chapter 5, Section 5.11, Using Files for Data Storage. Input Validation: Do not accept negative numbers for any data. For this exercise, you do not need to upload the PatientReport.txt file. It will be created when I run your program.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Constants and Variables
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning