Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hello I have a C++ problem. I am having problems displaying the calculations on this project. 16. Patient Fees Here are some suggestions: The names,

Hello I have a C++ problem. I am having problems displaying the calculations on this project.

16. Patient Fees Here are some suggestions: The names, parameters, and return types of each function and class member function should be decided in advance. The program will be best implemented as a multifile program.

Write a program that computes a patients bill for a hospital stay. The different components of the program are The PatientAccount class will keep a total of the patients charges. It will also keep track of the number of days spent in the hospital. The group must decide on the hospitals daily rate. The Surgery class will have stored within it the charges for at least five types of surgery. It can update the charges variable of the PatientAccount class. The Pharmacy class will have stored within it the price of at least five types of medication. It can update the charges variable of the PatientAccount class. The main program. The main program will design a menu that allows the user to enter a type of surgery, enter one or more types of medication, and check the patient out of the hospital. When the patient checks out, the total charges should be displayed.

Here is the code so far

#include #include #include using namespace std;

class surgery { public: static string surgry[]; static string medications[]; static float PriceS[]; public: float update() { float cost; cout << "Enter the updated surgery cost: "; cin >> cost; return (cost); } }; class pharmacy { public: static string medication[]; static float cost;

float getcost() { return cost; }

float update(int *x) { for (int a = 0; a < 5; a = a + 1) { cost = cost + x[a]; } return cost; }

}; string surgery::surgry[] = { "Breast Health Surgery", "Cardiac Surgery","Eye Surgery","General Surgery","Ear Surgery" }; string pharmacy::medication[] = { "Wellbutrin", "Prozac", "Straterra", "Adderall", "Ibuprofen" ,"Codein", "Vicodin" }; float surgery::PriceS[] = { 100.00,700.00,500.00,800.00,900.00 }; float pharmacy::cost = 0;

class PatientAccount { int days; float mcost, scost; int sr; int *ar; surgery srg; pharmacy prm; public: PatientAccount(int d, float s, int sre, float m, int x[]) { days = d; scost = s; mcost = m; sr = sre;

} public: int charges() { int ch; cout << "Press 1 to update the cost of"; cin >> ch;

if (ch == 1) scost = srg.update();

cout << "Press 1 to update the medicines" << "cost: "; cin >> ch;

if (ch == 1) mcost = prm.update(ar);

return (int)(days*mcost + scost); } }; int main() { int i = 0, surgery_done, d, n; float medicine_cost = 0, surgery_cost; surgery sr; int j = 0, x[7]; pharmacy pr; static int t = 0; int r = 1; cout << "Welcome to hospital billing"; cout << " Type of surgeries available "; while (i<5) { cout << i + 1 << " " << surgery::surgry[i] << " "; i++;

} cout << " Enter the surgery done: "; cin >> surgery_done; surgery_cost = sr.PriceS[surgery_done - 1]; cout << "Types of medication available "; while (j<7) { cout << j + 1 << " " << pharmacy::medication[j] << " ";

j++; } do { cout << "Enter the medication use: "; cin >> x[t]; t++; cout << " Press 1 to enter more medicines: "; cin >> n; } while (n == 1);

while (r) { medicine_cost = medicine_cost + pr.getcost(); r++; } cout << "Enter the number of days spent at hospital: "; cin >> d; PatientAccount pa(d, surgery_cost, surgery_done, medicine_cost, x); cout << " Total charges are: $ " << medicine_cost;

system("Pause"); return 0; }

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

DB2 Universal Database V7.1 Application Development Certification Guide

Authors: Steve Sanyal, David Martineau, Kevin Gashyna, Michael Kyprianou

1st Edition

0130913677, 978-0130913678

More Books

Students also viewed these Databases questions

Question

Explain how to build high-performance service delivery teams.

Answered: 1 week ago