Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

help in c++ pls Write a program that computes and displays the charges for a patient's hospital visit. The program should accomplish the following: -

help in c++ plsimage text in transcribed

Write a program that computes and displays the charges for a patient's hospital visit. The program should accomplish the following: - Read in a character representing whether the patient is inpatient or outpatient. An 'I' should be interpreted as inpatient and an ' O ' should be interpreted as outpatient. - If the patient is inpatient, read in and validate the following data: - The number of days spent in the hospital - The daily rate - Hospital medication charges - Charges for hospital services (lab tests, etc.) - If the patient is outpatient, read in and validate the following data: - Hospital medication charges - Charges for hospital services (lab tests, etc.) - Use two overloaded functions to calculate the total charges: - The first function should accept arguments for the inpatient data and should have a function header as follows: double patientCharges (int days, double rate, double med, double serv) It will calculate the total charges as days times daily rate plus medical charges plus service charges and return that value. - The second function will accept arguments for outpatient information with a function header as follows: double patientCharges (double med, double serv) It will calculate the total charges as medical charges plus service charges and return that value. - Use a function to output the dashes. Accept the number of dashes to be output as an argument. An appropriate function header is as follows: void printDashes (int num) There are 26 dashes in the output table. - Output all dollar amounts right justified in a field width of 10. - Input Validation: Do not accept anything but 'I' or 'O' for patient type. Do not accept negative numbers for any data. When the input is as shown in Figure 1, your program should produce the output as shown in Figure 2. Figure 1: (sample input) 1iI11289.75289.7538.53138.5310251025 Figure 2: (sample output) $$289.75-1daysat$289.75perday38.53-medicationcharges

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

Step: 3

blur-text-image

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

Database Concepts

Authors: David M. Kroenke, David J. Auer

7th edition

133544621, 133544626, 0-13-354462-1, 978-0133544626

More Books

Students also viewed these Databases questions

Question

Timeline for final evaluation

Answered: 1 week ago

Question

7. Explain why retirees may be valuable as part-time employees.

Answered: 1 week ago

Question

3. Provide advice on how to help a plateaued employee.

Answered: 1 week ago