-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
83 lines (59 loc) · 2.33 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
//Jose Gil Santaella Colon cecs 2203-21
//Patient Bill project
//This is a program that computes a patient's bill for a hospital stay.
#include <iostream>
#include <cstring>
#include "SurgeryClass.h"
#include "PatientAccount.h"
#include "Pharmacy.h"
#include <iomanip>
using namespace std;
int main()
{
char another;//to hold loop exit variable
int choice, days;
string line;
line.assign(50, '-'); //To print 50 line char to divide the menu
PatientAccount bill;//Patient Account object
//Loop for outputting menu info for different patients
do {
cout << "Hospital Menu" << endl;
cout << line << endl;
cout << "Select the type of surgery" << endl;
cout << "1. Arm Surgery" << endl;
cout << "2. Hip Surgery" << endl;
cout << "3. LowerBack Surgery" << endl;
cout << "4. Ankles Surgery" << endl;
cout << "5. Head Surgery" << endl;
cin >> choice;
bill.setSurgeryCharge(choice);
//Nested loop for outputting the medications menu
do
{
cout << line << endl;
cout << "Which medications did the patient take? (enter 9 to exit)" << endl;
cout << "1. Cannabis Treatment" << endl;
cout << "2. Pain Killers" << endl;
cout << "3. Blood transfusion" << endl;
cout << "4. Vitamins " << endl;
cout << "5. IV" << endl;
cin >> choice;
bill.setPharmacyCharge(choice); //object to set the choice of medications
} while (choice != 9);//sentinel
cout << line << endl;
cout << "For how many days will the patient be at the hospital? ";
cin >> days;
bill.setDays(days);//object to set the amount of days in hospital stay
cout << endl << "Report" << endl;
cout << line << endl;
cout << setprecision(2) << fixed <<endl;
cout << "Total days at the hospital: " << bill.getDays() << endl;//object to get the amount of days
cout << "Hospital daily rate: $" << bill.getDailyRate() << endl;//object to get the daily rate for hospital stay
cout << "Total amount after check out: $" << bill.getCost() << endl;
bill.setCharges(0);//object to reset the charges for another patient check-out
cout << "Do you want to try with another patient? (Y/N) ";
cin >> another;
cout << endl << endl;
} while (another == 'Y' || another == 'y'); //Asks user if it wants to repeat the process
return 0;
}