-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtravelManager.cpp
More file actions
523 lines (442 loc) · 11.4 KB
/
travelManager.cpp
File metadata and controls
523 lines (442 loc) · 11.4 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
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
#include <iostream>
#include <fstream>
#include <iomanip>
#include <windows.h>
#include <string>
using namespace std;
void menu();
class ManageMenu
{
protected:
string userName; //hide admin name
public:
ManageMenu()
{
system("color 0A"); //change terminal color
cout << "\n\n\n\n\n\n\n\n\n\t Enter your Name to continue as an admin: ";
cin >> userName;
system("CLS");
menu();
}
~ManageMenu() {}
};
class Customers
{
public:
string name, gender, address;
int age;
long long mobileNo;
static int customerID;
char all[999];
void getDetails()
{
ofstream out("old-customers.txt", ios::app);
{
cout << "Enter Customer ID: ";
cin >> customerID;
cout << "Enter Name: ";
cin >> name;
cout << "Enter Age: ";
cin >> age;
cout << "Enter Mobile Number: ";
cin >> mobileNo;
cout << "Enter Address: ";
cin >> address;
cout << "Enter Gender: ";
cin >> gender;
}
out << "\nCustomer ID: " << customerID << "\nName: " << name << "\nAge: " << age << "\nMobile Number: "
<< mobileNo << "\nAddress: " << address << "\nGender: " << gender << endl;
out.close();
cout << "\nSaved \nNote: We have saved your record for future purchases\n" << endl;
}
void showDetails()
{
ifstream in("old-customers.txt");
{
if (!in)
{
cout << "File Error" << endl;
}
while (!(in.eof()))
{
in.getline(all, 999);
cout << all << endl;
}
in.close();
}
}
};
int Customers::customerID;
class Cabs
{
public:
int cabChoice;
int kilometers;
float cabCost;
static float lastCabCost;
void cabDetails()
{
cout << "We collaborated with fastest, safest, and smartest cab service around the country" << endl;
cout << "-------------------------------ABC Cabs------------------------------------------\n" << endl;
cout << "1. Rent a Standard Cab - $0.49 per mile\n";
cout << "2. Rent a Luxury Cab - $0.69 per mile\n";
cout << "\nTo calculate the cost for the journey: " << endl;
cout << "Enter which kind of cab you need: ";
cin >> cabChoice;
cout << "Enter the kilometers you have to travel: ";
cin >> kilometers;
int hireCab;
if (cabChoice == 1)
{
cabCost = kilometers * .49;
cout << "\nYour total tour cost $" << cabCost << " for a Standard Cab\n";
cout << "Press 1 to hire this cab: \n";
cout << "Press 2 to select another cab: ";
cin >> hireCab;
system("CLS");
if (hireCab == 1)
{
lastCabCost = cabCost;
cout << "\nYou have successfully hired a Standard Cab\n";
cout << "Goto Menu and take the receipt" << endl;
}
else if (hireCab == 2)
{
cabDetails();
}
else
{
cout << "Invalid Input! Redirecting to previous menu \nPlease Wait..." << endl;
Sleep(1100);
system("CLS");
cabDetails();
}
}
else if (cabChoice == 2)
{
cabCost = kilometers * .69;
cout << "\nYour total tour cost $" << cabChoice << "for a Luxury Cab\n";
cout << "Press 1 to hire this cab: \n";
cout << "Press 2 to select another cab: ";
cin >> hireCab;
system("CLS");
if (hireCab == 1)
{
lastCabCost = cabChoice;
cout << "\nYou have successfully hired a Luxury Cab\n";
cout << "Goto Menu and take the receipt" << endl;
}
else if (hireCab == 2)
{
cabDetails();
}
else
{
cout << "Invalid Input! Redirecting to main menu \nPlease Wait..." << endl;
Sleep(1100);
system("CLS");
menu();
}
cout << "\nPress 1 to Redirect main menu: ";
cin >> hireCab;
system("CLS");
if (hireCab == 1)
{
menu();
}
else
{
menu();
}
}
}
};
float Cabs::lastCabCost;
class Bookings
{
public:
int choiceHotel;
int packChoice;
static float hotelCost;
void hotels()
{
string hotelNo[] = { "Avendra", "ChoiceYou", "ElephantBay" };
for (int a = 0; a < 3; a++)
cout << (a + 1) << ". Hotel" << hotelNo[a] << endl;
cout << "\nCurrently we collaborated with above hotels!" << endl;
cout << "Press any key to back or\n Enter the hotel number you want to book: ";
cin >> choiceHotel;
system("CLS");
if (choiceHotel == 1) {
cout << "-----------------Welcome to Hotel Avendra-----------------" << endl;
cout << "The Garden, food and beverage. Enjoy all you can drink, stay cool, and relax under the summer sun." << endl;
cout << "Packages offered by Avendra:\n" << endl;
cout << "1. Standard Pack" << endl;
cout << "\tAll basic facilities you need just for: $1000.00" << endl;
cout << "2. Premium Pack" << endl;
cout << "\tEnjoy Premium: $5000.00" << endl;
cout << "3. Luxury Pack" << endl;
cout << "\tLive like a king at Avendra: $20000.00" << endl;
cout << "\nPress another key to go back or\nEnter the package number you want to book: ";
cin >> packChoice;
if (packChoice == 1)
{
hotelCost = 1000.00;
cout << "\nYou have successfully booked Standard Pack at Avendra" << endl;
cout << "Goto Menu and take the receipt" << endl;
}
else if (packChoice == 2)
{
hotelCost == 5000.00;
cout << "\nYou have successfully booked Premium Pack at Avendra" << endl;
}
else if (packChoice == 3)
{
hotelCost = 20000.00;
cout << "\nYou have successfully booked Luxury Pack at Avendra" << endl;
}
else
{
cout << "Invalid Input! Redirecting to Previous Menu \nPlease Wait!" << endl;
Sleep(1100);
system("CLS");
hotels();
}
int gotoMenu;
cout << "\nPress 1 to redirect main menu: ";
cin >> gotoMenu;
if (gotoMenu == 1)
{
menu();
}
else {
menu();
}
}
else if (choiceHotel == 2) {
cout << "-----------------Welcome to Hotel ChoiceYou-----------------" << endl;
cout << "The pools, spa, and local beaches are all things you must experience in Hotel ChoiceYou." << endl;
cout << "Packages offered by ChoiceYou:\n" << endl;
cout << "1. Bronze Pack" << endl;
cout << "\tAccess to the public pool and one spa visit for: $1499.99" << endl;
cout << "2. Silve Pack" << endl;
cout << "\tEnjoy unlimited spa visits and access to all pools: $7999.99" << endl;
cout << "3. Gold Pack" << endl;
cout << "\tUnlimited spa and pool visits, a king's suite, and access to the private pool: $26999.99" << endl;
cout << "\nPress another key to go back or\nEnter the package number you want to book: ";
cin >> packChoice;
if (packChoice == 1)
{
hotelCost = 1499.99;
cout << "\nYou have successfully booked the Bronze Pack at ChoiceYou" << endl;
cout << "Goto Menu and take the receipt" << endl;
}
else if (packChoice == 2)
{
hotelCost == 7999.99;
cout << "\nYou have successfully booked Silver Pack at ChoiceYou" << endl;
}
else if (packChoice == 3)
{
hotelCost = 26999.99;
cout << "\nYou have successfully booked Gold Pack at ChoiceYou" << endl;
}
else
{
cout << "Invalid Input! Redirecting to Previous Menu \nPlease Wait!" << endl;
Sleep(1100);
system("CLS");
hotels();
}
int gotoMenu;
cout << "\nPress 1 to Redirect Main Menu: ";
cin >> gotoMenu;
}
else if (choiceHotel == 3)
{
cout << "-----------------Welcome to Hotel ElephantBay-----------------" << endl;
cout << "Set in tropical gardens onthe banks of the Maya Oya river while seeing elephants" << endl;
cout << "Incredible offer this summer: $3000.00 for one day!\n" << endl;
cout << "\nPress another key to back or\nPress 1 to book this special package: ";
cin >> packChoice;
if (packChoice == 1)
{
hotelCost = 3000.00;
cout << "\nYou have successfully booked the a room at ElephantBay" << endl;
cout << "Goto Menu and take the receipt" << endl;
}
else
{
cout << "Invalid Input! Redirecting to Previous Menu \nPlease Wait!" << endl;
Sleep(1100);
system("CLS");
hotels();
}
int gotoMenu;
cout << "\nPress 1 to Redirect Main Menu: ";
cin >> gotoMenu;
system("CLS");
if (gotoMenu == 1)
{
menu();
}
else {
menu();
}
}
else {
cout << "Invalid Input! Redirecting to Previous Menu \nPlease Wait!" << endl;
Sleep(1100);
system("CLS");
menu();
}
}
};
float Bookings::hotelCost;
class Charges : public Bookings, Cabs, Customers
{
public:
void printBill()
{
ofstream outf("reciept.txt");
{
outf << "----ABC Travel Agency----" << endl;
outf << "---------Receipt---------" << endl;
outf << "__________________________" << endl;
outf << "Customer ID: " << Customers::customerID << endl << endl;
outf << "Description\t\t Total" << endl;
outf << "Hotel cost:\t\t " << fixed << setprecision(2) << Bookings::hotelCost << endl;
outf << "Travel (cab) cost:\t " << fixed << setprecision(2) << Cabs::lastCabCost << endl;
outf << "__________________________" << endl;
outf << "Total Charge:\t\t " << fixed << setprecision(2) << Bookings::hotelCost + Cabs::lastCabCost << endl;
outf << "__________________________" << endl;
outf << "--------Thank you---------" << endl;
}
outf.close();
}
void showBill()
{
ifstream inf("receipt.txt");
{
if (!inf)
{
cout << "File Error!" << endl;
}
while (!(inf.eof()))
{
inf.getline(all, 999);
cout << all << endl;
}
}
inf.close();
}
};
void menu()
{
int mainChoice;
int inChoice;
int gotoMenu;
cout << "\t\t * ABC Travels *\n" << endl;
cout << "------------------------Main Menu------------------------" << endl;
cout << "\t _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ " << endl;
cout << "\t|\t\t\t\t\t|" << endl;
cout << "\t|\tCustomer Management -> 1\t|" << endl;
cout << "\t|\tCabs Management -> 2\t|" << endl;
cout << "\t|\tBookings Management -> 3\t|" << endl;
cout << "\t|\tCharges & Bill -> 4\t|" << endl;
cout << "\t|\tExit -> 5\t|" << endl;
cout << "\t|\t\t\t\t\t|" << endl;
cout << "\t|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|" << endl;
cout << "\nEnter your choice: ";
cin >> mainChoice;
system("CLS");
Customers a2;
Cabs a3;
Bookings a4;
Charges a5;
if (mainChoice == 1)
{
cout << "------Customers------\n" << endl;
cout << "1. Enter New Customer" << endl;
cout << "2. See Old Customers" << endl;
cout << "\nEnter Choice: ";
cin >> inChoice;
system("CLS");
if (inChoice == 1) {
a2.getDetails();
}
else if (inChoice == 2)
{
a2.showDetails();
}
else
{
cout << "Invalid Input! Redirecting to previous menu \nPlease Wait!" << endl;
Sleep(1100);
system("CLS");
menu();
}
cout << "\nPress 1 to Redirect main menu: ";
cin >> gotoMenu;
system("CLS");
if (gotoMenu == 1)
{
menu();
}
else
{
menu();
}
}
else if (mainChoice == 2) {
a3.cabDetails();
}
else if (mainChoice == 3) {
cout << "--> Book a luxury hotel using the system <--" << endl;
a4.hotels();
}
else if (mainChoice == 4) {
cout << "-->Get your receipt <--" << endl;
a5.printBill();
cout << "Your receipt has already printed, you can get it from file path,\n" << endl;
cout << "To display your receipt on the screen, enter 1, or enter another key to go back to main menu: ";
cin >> gotoMenu;
if (gotoMenu == 1) {
system("CLS");
a5.showBill();
cout << "\nPress 1 to redirect main menu: ";
cin >> gotoMenu;
system("CLS");
if (gotoMenu == 1)
{
menu();
}
else {
menu();
}
}
else {
system("CLS");
menu();
}
}
else if (mainChoice == 5)
{
cout << "--GOOD-BYE--" << endl;
Sleep(999);
system("CLS");
menu();
}
else {
cout << "Invalid Input! Redirecting to previous menu \nPlease Wait!" << endl;
Sleep(1100);
system("CLS");
menu();
}
}
int main()
{
ManageMenu startObj;
return 0;
}