-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfourthAssignment.cpp
More file actions
128 lines (117 loc) · 3.51 KB
/
fourthAssignment.cpp
File metadata and controls
128 lines (117 loc) · 3.51 KB
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/*
============================================================================
Name : fourthAssignment.cpp
Author : grosalex
Version :
Copyright : do what you want with it
Description : Hello World in C++,
============================================================================
*/
#include <iostream>
#include "HospitalManager.h"
using namespace std;
int main(void) {
char choice=' ';
char createChoice=' ';
bool check=false;
int physID;
int patID;
int i=0;
int index;
int employeeID;
HospitalManager * myManager= new HospitalManager();
/*
1 - add employee
2 - delete employee : ask for employee id, remove from employee id
3 - add patient :
- ask for physician (display all physicians)
- ask for bed number (corresponding to index in bedarray)
4 - delete patient (discharge patient) :
- ask for patient id, remove from patient array
- move to discharged patient
5 - print physicians()
6 - print my patient (sending physician id parameter)
7 - print earnings (int employeeid)*/
do{
cout << "1 - Add employee" << endl;
cout << "2 - Delete employee" << endl;
cout << "3 - Add Patient" << endl;
cout << "4 - Discharge patient" << endl;
cout << "5 - Print physicians" << endl;
cout << "6 - Print patient's physicians" << endl;
cout << "7 - Print employee informations" << endl;
cout << "q - To quit" << endl;
cin >> choice;
switch(choice){
case '1':
cout << "To add a nurse enter n. To add a staff enter s. to add a physician enter p.";
cin >> createChoice;
switch(createChoice){
case'n':
check=myManager->add_employee(new Nurses());
break;
case's':
check=myManager->add_employee(new Staff());
break;
case'p':
check=myManager->add_employee(new Physicians());
break;
}
if(check){
cout << "Employee correctly added"<< endl;
}
else{
cout << "Couldn't add the employee" << endl;
}
createChoice=' ';
break;
case '2':
myManager->printallpersonnel();
cout << endl << "which employee do you want to delete (by his employee id) : ";
cin >> index;
check=myManager->remove(index);
if(check){
cout << endl << "employee successfully removed" << endl;
}
else{
cout << endl << "failed to remove employee" << endl;
}
break;
case '3':
//Patient* newpatient = new Patient();
cout << endl << "Which physician you want ?" << endl;
myManager->print_physicians();
cin >> physID;
cout << endl << "Enter patient informations : " << endl;
check = myManager->patient_admission(new Patient(),physID);
if(check) cout << "Patient successfully admitted." << endl;
else cout << "Error, patient not admitted." << endl;
break;
case '4':
cout << "Enter ID of discharged patient :";
cin >> patID;
check = myManager->patient_discharge(patID);
if(check) cout << "Patient successfully discharged." << endl;
else cout << "Patient wasn't discharged." << endl;
break;
case '5':
myManager->print_physicians();
break;
case '6':
myManager->print_physicians();
cout << endl << "Which physician's patient do you want to print?(enter his employee id)";
cin >> index;
myManager->print_mypatients(index);
break;
case '7':
myManager->printallpersonnel();
cout << "Enter employee ID";
cin >> employeeID;
myManager->print(employeeID);
break;
default:
break;
}
}while(choice!='q');
return 0;
}