-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathmain.cpp
More file actions
233 lines (217 loc) · 9.68 KB
/
main.cpp
File metadata and controls
233 lines (217 loc) · 9.68 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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
#include <iostream>
#include "classes&functions.h"
#include <conio.h>
/*
```````############################# GROUP I #############################
1 - ANKRAH Vince Churchill - 7092021
2 - OCHIR Uncle Jojo - 7104821
3 - MUSTAPHA Iddriss Hamidu - 7103921
4 - ESSIEN Ernest Kojo - 7098521
5 - TIJANI Hassan Cissey - 7110021
6 - ESSIEDU Daniel - 7098421
7 - OFORI Isaac Nana Kwabena Nyame - 7105621
8 - OFORI Twum Michael - 7105821
9 - TAMAKLOE Mark Sivan - 7109421
10 - AYOMAH Richard Arthur - 7093921
11 - GAWU-MENSAH Sidney Selorm Kofi - 7098821
12 - AWUKU Samuel Akoto - 7093721
*/
int main() {
bool isProgramRunning, adminMenu, guestMenu;
do {
intro();
std::cout << "\nHOTEL MANAGEMENT APPLICATION"
<< "\n---------------------------------"
<< "\nADMIN LOGIN - Press a"
<< "\nGUEST LOGIN - Press g"
<< "\nEXIT PROGRAM - Press ESC\n\n";
int option = getch();
Guest guest1;
Admin admin1;
if (option == a) {
bool login_success = admin1.adminLogin();
if(login_success) {
do {
adminMenu = false;
char choice;
std::cout << "\nPlease enter an option"
<< "\n---------------------------------"
<< "\n1. Show all rooms"
<< "\n2. Search for a particular room"
<< "\n3. Search for available rooms"
<< "\n4. Add room"
<< "\n5. Remove a room"
<< "\n6. Show all guests"
<< "\n7. Search for Guest"
<< "\n8. Add Guest"
<< "\n9. Remove Guest"
<< "\nb. Back to main menu"
<< "\ne. Exit\n";
// << "\nEnter 0 to go back\n\n";
std::cout << "> > ";
std::cin >> choice;
switch (choice) {
case '1':
admin1.showAllRooms();
std::cout << "\nPerform another task? (y/n[Back to main menu])\n> >";
choice = getch();
if(choice == 'n') isProgramRunning = true;
else if (choice == 'y') adminMenu = true;
break;
case '2':
admin1.searchForRoom();
std::cout << "\nPerform another task? (y/n[Back to main menu])\n> >";
choice = getch();
if(choice == 'n') isProgramRunning = true;
else if (choice == 'y') adminMenu = true;
break;
case '3':
admin1.searchAvailableRooms();
std::cout << "\nPerform another task? (y/n[Back to main menu])\n> >";
choice = getch();
if(choice == 'n') isProgramRunning = true;
else if (choice == 'y') adminMenu = true;
break;
case '4':
admin1.addRoom();
std::cout << "\nPerform another task? (y/n[Back to main menu])\n> >";
choice = getch();
if(choice == 'n') isProgramRunning = true;
else if (choice == 'y') adminMenu = true;
break;
case '5':
admin1.removeRoom();
std::cout << "\nPerform another task? (y/n[Back to main menu])\n> >";
choice = getch();
if(choice == 'n') isProgramRunning = true;
else if (choice == 'y') adminMenu = true;
break;
case '6':
admin1.showAllGuests();
std::cout << "\nPerform another task? (y/n[Back to main menu])\n> >";
choice = getch();
if(choice == 'n') isProgramRunning = true;
else if (choice == 'y') adminMenu = true;
break;
case '7':
admin1.searchForGuest();
std::cout << "\nPerform another task? (y/n[Back to main menu])\n> >";
choice = getch();
if(choice == 'n') isProgramRunning = true;
else if (choice == 'y') adminMenu = true;
break;
case '8':
admin1.addGuest();
std::cout << "\nPerform another task? (y/n[Back to main menu])\n> >";
choice = getch();
if(choice == 'n') isProgramRunning = true;
else if (choice == 'y') adminMenu = true;
break;
case '9':
admin1.removeGuest();
std::cout << "\nPerform another task? (y/n[Back to main menu])\n> >";
choice = getch();
if(choice == 'n') isProgramRunning = true;
else if (choice == 'y') adminMenu = true;
break;
case 'b':
isProgramRunning = true;
break;
case 'e':
isProgramRunning = false;
break;
default:
std::cout<< "\nYou entered an invalid option, please try again."<< endl;
adminMenu = true;
break;
}
} while(adminMenu);
}
}
else if (option == g) {
char choice;
do {
guestMenu = false;
std::cout << "\nPlease enter an option"
<< "\n----------------------------------"
<< "\n1. Search for available rooms"
<< "\n2. Check for personal details"
<< "\n3. Leave room"
<< "\n4. Back to Main Menu\n\n"
<< "\n5. Exit\n\n";
string name, f_name, l_name, ID;
bool login_success;
std::cin >> choice;
switch (choice)
{
case '1':
std::cout << "These are the rooms available:"
<< "\n---------------------------------------\n";
admin1.searchAvailableRooms();
std::cout << "\nPerform another action?(y/n [Back to main menu])\n > >";
choice = getch();
if(choice == 'n') isProgramRunning = true;
else if (choice == 'y') guestMenu = true;
break;
case '2':
std::cout << "Enter your first name: ";
std::cin >> f_name;
std::cout << "Enter your last name: ";
std::cin >> l_name;
name = l_name + " " + f_name;
std::cout << "Enter you ID: ";
std::cin >> ID;
login_success = guest1.guestLogin(name, ID);
if(login_success){
admin1.searchForGuest(name, ID);
std::cout << "\nPerform another action?(y/n [Back to main menu])\n > >";
choice = getch();
if(choice == 'n') isProgramRunning = true;
else if (choice == 'y') guestMenu = true;
}
else guestMenu = true;
break;
case '3':
std::cout << "Enter your first name: ";
std::cin >> f_name;
std::cout << "Enter your last name: ";
std::cin >> l_name;
name = l_name + " " + f_name;
std::cout << "Enter you ID: ";
std::cin >> ID;
login_success = guest1.guestLogin(name, ID);
if(login_success){
admin1.removeGuest(name, ID);
std::cout << "\nPerform another action?(y/n [Back to main menu])\n > >";
choice = getch();
if(choice == 'n') isProgramRunning = true;
else if (choice == 'y') guestMenu = true;
} else guestMenu = true;
break;
case '4':
isProgramRunning = true;
break;
case '5':
isProgramRunning = false;
break;
case 'y':
guestMenu = true;
break;
case 'n' :
isProgramRunning = true;
break;
default:
std::cout<< "\nYou entered an invalid option, please try again.\n"<< endl;
guestMenu = true;
// if(choice == 'n') goto main_menu;
break;
}
} while(guestMenu);
}
else if (option == ESC) {
isProgramRunning = false;
}
} while(isProgramRunning);
outro();
return 0;
}