-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
897 lines (805 loc) · 25 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
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
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
#include <iostream>
#include <string>
#include <string.h>
#include <iomanip>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cctype>
#include "PaymentIntegration/accountNumber.h"
#include "bus_city_info.h"
using namespace std;
struct reserve
{
string fullName;
string destination, initial_city;
unsigned int age;
int payement;
int accountNumber;
int securityNumber;
int resrvd_seat;
int ticket_size;
int return_oneWay;
float travelling_distance;
bool is_reserverd;
bool is_prepaid;
int dest_no, bus_code;
string resrvd_bus;
string leaving_time;
};
reserve *resrvd_acc[1000];
// functions participating in reserving a seat
void reserveSeat();
float distance_calculator(int, int);
bool bus_assignment(int, int, reserve *[], int &);
int change_leaving_time(int);
float payement_calculator(int, reserve *[], bool);
void confirm_resrv(int);
void receipt(int);
//global functions
int first_ui();
void date_time();
//interface of customer
int cust_first_ui();
void respond_cust_request();
int search_destination();
void modify_reservation(int);
void cancel_reservation(int, int, int);
void see_reservation();
//login page functions
bool login_page(int);
bool login_success(int, int, string, string);
// ticketer interface
int ticketer_interface();
void respond_ticketer_request(int);
// administrator functions
int admnistrator_interface();
void respond_admin_request(int);
void add_city();
void remove_city();
void show_all_reservation();
void massBusReservation_cancel();
void massDestReservation_cancel();
void cancelAll_reservation();
void generate_report();
// global variable
int resrv_counter = 0;
float total_payement_received = 0;
int main()
{
// random_number generator
random_generator(random1);
random_generator(random2);
// user-defined library functions
bankInformation();
destinationCity();
//login_information container
login_info();
first_ui();
}
// Home page
int first_ui()
{
system("cls");
bool do_not_exit = true;
while (do_not_exit)
{
cout << right << setw(10) << "Welcome to Bus X reservation system\n";
cout << "[1] Enter as customer \n"
<< "[2] Login as Ticketer \n"
<< "[3] Login as Administrator \n";
int choice;
cin >> choice;
switch (choice)
{
case 1:
respond_cust_request();
break;
case 2:
respond_ticketer_request(choice);
break;
case 3:
respond_admin_request(choice);
break;
default:
do_not_exit = false;
break;
}
}
}
// homepage for customer
int cust_first_ui()
{
//system("cls");
cout << "Welcome to CompanyX Bus Reservation System \n"
<< "[1] Search destination\n"
<< "[2] Make Reservation \n"
<< "[3] See Your Reservation \n"
<< "[4] Create a new prepaid card \n"
<< "[5] Deposit to prepaid card\n"
<< "[press any number other than specified] to continue\n";
int option;
cin >> option;
return option;
}
void respond_cust_request()
{
bool do_not_exit = true;
int option;
while (do_not_exit)
{
option = cust_first_ui();
switch (option)
{
case 1:
search_destination();
break;
case 2:
reserveSeat();
break;
case 3:
see_reservation();
break;
case 4:
create_prepaidAccount();
break;
case 5:
deposit_prepaid();
break;
default:
system("cls");
do_not_exit = false;
break;
}
}
}
// searching destination
int search_destination()
{
system("cls");
cout << "Enter name of the city: ";
string city_name;
cin >> city_name;
int city_index;
bool found = false;
for (int i = 0; i < cityNo_count; i++)
// if the city the customer searches are on the destination name
if (city_name == cities_info[i]->city_name)
{
city_index = i;
found = true;
}
if (found)
{
cout << "Name: " << cities_info[city_index]->city_name << endl
<< "Distance from AA: " << cities_info[city_index]->km_from_AA << endl
<< "Direction from AA: " << cities_info[city_index]->direction << endl
<< "Leaving Time: ";
for (int j = 0; j < 2; j++)
cout << cities_info[city_index]->busDestInfo.leaving_time[j] << " ";
bool cityExists = false;
for (int i = 0; i < 2; i++)
if (cities_info[city_index]->busDestInfo.seatAvailble[i] > 0)
cityExists = true;
cout << "\nAvailable: ";
if (cityExists)
cout << "Yes\n";
else
cout << "No\n";
}
else
cout << "\n No such city found in our database\n";
}
// reserve seat
void reserveSeat()
{
system("cls");
// create a new reserve everytime this function is called
resrvd_acc[resrv_counter] = new reserve;
cout << "Enter FullName: ";
string fname, lname;
cin >> fname >> lname;
resrvd_acc[resrv_counter]->fullName = fname + " " + lname;
cout << "Enter your age: ";
cin >> resrvd_acc[resrv_counter]->age;
while (resrvd_acc[resrv_counter]->age < 18)
{
cout << "You are under Age: ";
cin >> resrvd_acc[resrv_counter]->age;
}
// travelling city information;
label:
cout << "Choose starting Point: ";
int startingPoint = travelling_city() - 1;
cout << "Choose Destination City: ";
int destination = travelling_city() - 1;
resrvd_acc[resrv_counter]->dest_no = destination;
// calculating distance between starting city and destination city;
// checks whether customer enters the same name at both destination and starting city
if (startingPoint != destination)
{
// assign a city to customer information
resrvd_acc[resrv_counter]->destination = cities_info[destination]->city_name;
resrvd_acc[resrv_counter]->initial_city = cities_info[startingPoint]->city_name;
resrvd_acc[resrv_counter]->travelling_distance = distance_calculator(destination, startingPoint);
}
else
{
cout << "No inside service:Please enter again! \n";
goto label;
}
cout << "Choose Travelling option \n"
<< "[1] One Way \n"
<< "[2] Round Trip: ";
cin >> resrvd_acc[resrv_counter]->return_oneWay;
cout << "Number of tickets: ";
cin >> resrvd_acc[resrv_counter]->ticket_size;
// asking a customer for time of reservation
cout << "Leaving Time: \n";
for (int i = 0; i < 2; i++)
{
cout << "[" << i + 1 << "] " << l_time[i] << endl;
}
int l_time_choice;
cin >> l_time_choice;
l_time_choice -= 1;
// assigning bus to a customer
// bus_assignment also checks if there's avaible seat
bool bus_available = bus_assignment(destination, resrv_counter, resrvd_acc, (l_time_choice));
if (bus_available)
{
// payement
cout << "Choose payement method\n"
<< "[1] Prepaid\n"
<< "[2] Bank \n";
int payement_method;
cin >> payement_method;
if (payement_method == 1)
resrvd_acc[resrv_counter]->is_prepaid = true;
else
resrvd_acc[resrv_counter]->is_prepaid = false;
// Bank Account Information;
cout << "Enter account: ";
cin >> resrvd_acc[resrv_counter]->accountNumber;
cout << "Enter security Code: ";
cin >> resrvd_acc[resrv_counter]->securityNumber;
// calculates total payement;
float payement = payement_calculator(resrv_counter, resrvd_acc,
resrvd_acc[resrv_counter]->is_prepaid);
resrvd_acc[resrv_counter]->payement = payement;
// confirm payement and reservation;
confirm_resrv(resrv_counter);
cout << "Do you want to continue \n (Y\\N)";
char confirm;
cin >> confirm;
confirm = tolower(confirm);
if (confirm == 'y')
{
// check your payement information from banks
// if the customer have balance that allows him to reserve a seat success will be true.
bool success = accountCheck(resrvd_acc[resrv_counter]->payement,
resrvd_acc[resrv_counter]->accountNumber,
resrvd_acc[resrv_counter]->securityNumber,
resrvd_acc[resrv_counter]->is_prepaid, true);
if (success)
{
resrvd_acc[resrv_counter]->resrvd_seat = (100 - bus_rg[destination]->seatAvailble[l_time_choice]);
receipt(resrv_counter);
resrvd_acc[resrv_counter]->is_reserverd = true;
resrvd_acc[resrv_counter]->bus_code = l_time_choice;
// recording payement information
bus_rg[destination]->payement[l_time_choice] += payement;
total_payement_received += payement;
resrv_counter++;
}
else
{ /* if customer does provide accountNumber that does not exist,
does not have enough balance in the account, and
haven't not provided correct security code, cancel the reservation
*/
delete resrvd_acc[resrv_counter];
cout << "Transaction was not successful \n"
<< "Please check your bank information \n";
}
}
else
{
// if the customer do not want to continue cancle reservation
delete resrvd_acc[resrv_counter];
cout << "Request canceled \n";
}
}
}
// distance calculator
float distance_calculator(int destination, int startingPoint)
{
float distance_km;
// if the two cities are on the same direction
if (cities_info[destination]->direction == cities_info[startingPoint]->direction)
{
distance_km = cities_info[destination]->km_from_AA -
cities_info[startingPoint]->km_from_AA;
distance_km = (distance_km < 0) ? ((-1) * distance_km) : distance_km;
}
else // if the two cities are on different direction;
{
cout << "Choose path: "
<< "[1] Through Addis Ababa \n"
<< "[2] Direct way \n";
int option;
cin >> option;
switch (option)
{
case 1:
{
distance_km = (cities_info[destination]->km_from_AA +
cities_info[startingPoint]->km_from_AA);
break;
}
case 2:
{
distance_km = sqrt(pow(cities_info[destination]->km_from_AA, 2) +
pow(cities_info[startingPoint]->km_from_AA, 2));
break;
}
default:
break;
}
}
return distance_km;
}
// assignning bus to a customer;
bool bus_assignment(int d_num, int resrv_counter, reserve *resrvd_acc[], int &l_choice)
{
int time_changed;
bool seat_exist;
if (bus_rg[d_num]->seatAvailble[l_choice] > 0)
seat_exist = true;
// if time customer request is not available
else
{
time_changed = change_leaving_time(l_choice);
if (time_changed != l_choice)
{
seat_exist = true;
l_choice = time_changed;
}
else
seat_exist = false;
}
if (seat_exist)
{
resrvd_acc[resrv_counter]->resrvd_bus = bus_rg[d_num]->bus_cd[l_choice];
resrvd_acc[resrv_counter]->leaving_time = l_time[l_choice];
bus_rg[d_num]->seatAvailble[l_choice]--;
return true;
}
else
return false;
}
// if bus is not available at requested time
int change_leaving_time(int l_choice)
{
char change;
int time_index;
cout << "NO seat available at " << l_time[l_choice] << "\n";
for (int i = 0; i < 2; i++)
if ((i != l_choice) && (bus_rg[i]->seatAvailble > 0))
{
cout << "Would you like to change time to: " << l_time[i];
time_index = i;
}
cout << (" y/n") << endl;
cin >> change;
change = tolower(change);
// if the customer changes time return the time index;
if (change == 'y')
{
return time_index;
}
else
return l_choice;
}
// calculating payement;
float payement_calculator(int resrv_counter, reserve *resrvd_acc[], bool isPrepaid)
{
float birr_per_km = 10;
float discount_rate = 20 / 100.0;
// prepaid card have discount
if (isPrepaid)
birr_per_km = birr_per_km - (birr_per_km * discount_rate);
float payement = resrvd_acc[resrv_counter]->return_oneWay *
resrvd_acc[resrv_counter]->ticket_size *
resrvd_acc[resrv_counter]->travelling_distance * birr_per_km;
return payement;
}
// confirm reservation
void confirm_resrv(int i)
{
system("cls");
cout << "Confirm Your Reservation\n\n";
cout << "Name: " << resrvd_acc[i]->fullName << endl;
cout << "Destination: " << resrvd_acc[i]->destination << endl;
cout << "Bus code : " << resrvd_acc[i]->resrvd_bus << endl;
cout << "Leaving time: " << resrvd_acc[i]->leaving_time << endl;
cout << "Distance in km: " << resrvd_acc[i]->travelling_distance << endl;
cout << "Total payment : " << resrvd_acc[i]->payement << endl;
}
void date_time()
{
std::time_t t = std::time(0); // get time now
std::tm *now = std::localtime(&t);
std::cout << (now->tm_year + 1900) << '-'
<< (now->tm_mon + 1) << '-'
<< now->tm_mday
<< "\n";
}
// printing receipt after confirming the transaction;
void receipt(int resrv_counter)
{
system("cls");
cout << right << setw(50) << "Bus X Transport Service\n";
cout << "Reciept \n";
cout << "Seat Number: " << resrvd_acc[resrv_counter]->resrvd_seat << endl;
cout << "Prepared for: " << resrvd_acc[resrv_counter]->fullName << endl;
cout << "Travel Info: From " << resrvd_acc[resrv_counter]->initial_city
<< " TO " << resrvd_acc[resrv_counter]->destination << endl;
cout << "Leaving Time: " << resrvd_acc[resrv_counter]->leaving_time << endl;
cout << "Date: ";
date_time();
cout << endl
<< endl;
cout << "Description Quantity price/Quantity Total Price " << endl;
cout << left << setw(10) << "Transport\t"
<< left << setw(10) << resrvd_acc[resrv_counter]->ticket_size << " "
<< left << setw(10) << resrvd_acc[resrv_counter]->travelling_distance / 10
<< left << setw(10) << resrvd_acc[resrv_counter]->payement << endl;
}
void see_reservation()
{
system("cls");
cout << "Enter FullName: ";
string fname, lname, name;
cin >> fname >> lname;
name = fname + " " + lname;
bool isFound = false;
int index;
for (int i = 0; i < resrv_counter; i++)
if (name == resrvd_acc[i]->fullName)
{
isFound = true;
index = i;
}
if (isFound)
{
receipt(index); // shows customer his reservation;
cout << "[1] To cancel reservation \n"
<< "[2] To change reservation \n"
<< "[press any number other than specified] to continue \n";
int option;
cin >> option;
switch (option)
{
case 1:
cancel_reservation(index, resrvd_acc[index]->dest_no, resrvd_acc[index]->bus_code);
cout << "Reservation canceled \n";
break;
case 2:
modify_reservation(index);
break;
default:
break;
}
}
else
cout << "No reservation under the name " << name << endl;
}
// cancel reservation: can be used to make cancel all the reservation;
void cancel_reservation(int cust_index, int i, int j)
{
//payback the money
float payement = resrvd_acc[cust_index]->payement;
bool isMoney_back = accountCheck(payement,
resrvd_acc[cust_index]->accountNumber,
resrvd_acc[cust_index]->securityNumber,
resrvd_acc[cust_index]->is_prepaid, false);
// deleting the reservation from system
for (int i = cust_index; i < resrv_counter; i++)
{
resrvd_acc[i] = resrvd_acc[i + 1];
}
// rearranging bus seat number and payement;
total_payement_received -= payement;
bus_rg[i]->payement[j] -= payement;
bus_rg[i]->seatAvailble[j]++;
delete resrvd_acc[resrv_counter];
resrvd_acc[resrv_counter] = NULL;
resrv_counter--;
}
// modifying reservation
void modify_reservation(int cust_index)
{
bool do_not_exit = true;
while (do_not_exit)
{
cout << "You can change the following information in your booking \n"
<< "[1] Your name \n"
<< "[2] Leaving Time: \n"
<< "[3] To Finish\n"
<< "[press any number other than specified] To continue" << endl;
int option;
cin >> option;
switch (option)
{
case 1:
{
cout << "Enter your new name: ";
string fname, lname;
cin >> fname >> lname;
resrvd_acc[cust_index]->fullName = fname + " " + lname;
cout << "Name changed successfuly \n";
break;
}
case 2:
{
cout << "Leaving Time: \n";
for (int i = 0; i < 2; i++)
cout << "[" << i + 1 << "] " << l_time[i] << endl;
int l_time_choice;
cin >> l_time_choice;
// Not the best way to do it, but for now
resrvd_acc[cust_index]->leaving_time = l_time[l_time_choice - 1];
cout << "Leaving time is changed successfuly \n";
break;
}
case 3:
receipt(cust_index);
break;
default:
system("cls");
do_not_exit = false;
break;
}
}
}
// second section of the project
// login page for ticketer and administrator
bool login_page(int i)
{
system("cls");
bool status;
string password, id;
cout << setw(10) << "Enter your Login information below\n";
cout << "Both ID and password are case sensitive \n";
cout << "ID NO: ";
cin >> id;
cout << "password: ";
cin >> password;
switch (i)
{
case 2:
status = login_success(0, num_access, id, password);
break;
case 3:
status = login_success(0, 1, id, password);
break;
default:
status = false;
break;
}
return status;
}
// confirms login credentials
bool login_success(int start, int end, string id, string password)
{
bool login_success = false;
for (int i = start; i < end; i++)
if ((id == login_create[i]->id) && (password == login_create[i]->password))
login_success = true;
return login_success;
}
// ticketer page
int ticketer_interface()
{
cout << "Welcome to CompanyX Bus Reservation System \n"
<< "[1] Reserve for customer\n"
<< "[2] Show All cities and Buses Assigned \n"
<< "[3] Show All Major Buses Information \n"
<< "[press any number other than specified] To continue\n";
int option;
cin >> option;
return option;
}
void respond_ticketer_request(int index)
{
if (login_page(index))
{
bool do_not_exit = true;
int option;
while (do_not_exit)
{
option = ticketer_interface();
switch (option)
{
case 1:
respond_cust_request();
break;
case 2:
list_cities(cities_info);
break;
case 3:
showBusInfo();
break;
case 4:
first_ui();
break;
default:
system("cls");
do_not_exit = false;
break;
}
}
}
else
cout << "Incorrect login information \n";
}
// administrator first user interfaces
int administrator_interface()
{
cout << "Welcome Mr. Admisnistrator \n"
<< "[1] To add city to lists \n"
<< "[2] To remove city from lists \n"
<< "[3] show all reservations \n"
<< "[4] To Grant a Ticketer priveledges \n"
<< "[5] Mass reservation cancelling \n"
<< "[6] Generate Report \n"
<< "[press any number other than specified] to continue \n";
int response;
cin >> response;
return response;
}
// functional response to administrator requests
void respond_admin_request(int index)
{
if (login_page(index))
{
bool do_not_exit = true;
while (do_not_exit)
{
int response = administrator_interface();
switch (response)
{
case 1:
add_city();
break;
case 2:
remove_city();
break;
case 3:
show_all_reservation();
break;
case 4:
create_ticketer_login();
break;
case 5:
cancelAll_reservation();
break;
case 6:
generate_report();
break;
default:
system("cls");
do_not_exit = false;
break;
}
}
}
else
cout << "Incorrect Login information \n";
}
void show_all_reservation()
{
system("cls");
cout << "Total Number of resrvation: " << resrv_counter << endl;
cout << " Full Name \t| Initial | Destination | "
<< "Bus Assigned | seatNumber | Leaving Time | Distance | payement\n";
cout << setprecision(1) << fixed;
for (int i = 0; i < resrv_counter; i++)
{
if (resrvd_acc[i] != NULL)
{
cout << " " << left << setw(5) << resrvd_acc[i]->fullName << right << setw(10)
<< resrvd_acc[i]->initial_city << right << setw(15)
<< resrvd_acc[i]->destination << right << setw(12)
<< resrvd_acc[i]->resrvd_bus << right << setw(12)
<< resrvd_acc[i]->resrvd_seat << right << setw(18)
<< resrvd_acc[i]->leaving_time << right << setw(10)
<< resrvd_acc[i]->travelling_distance << right << setw(10)
<< resrvd_acc[i]->payement << endl;
}
}
}
void cancelAll_reservation()
{
system("cls");
bool do_not_exit = true;
while (do_not_exit)
{
cout << "[1] To all reservation to destination\n"
<< "[2] To cancel specific buses reservation to destination\n"
<< "[press any number other than specified] to exit from current page \n";
int option;
cin >> option;
switch (option)
{
case 1:
massDestReservation_cancel();
break;
case 2:
massBusReservation_cancel();
break;
default:
do_not_exit = false;
break;
}
}
}
// mass bus reservation cancelling
void massBusReservation_cancel()
{
cout << "Enter bus code: ";
string bus_code;
cin >> bus_code;
bool is_canceled = false;
for (int i = 0; i < resrv_counter; i++)
if (resrvd_acc[i]->resrvd_bus == bus_code)
{
cancel_reservation(i, resrvd_acc[i]->dest_no, resrvd_acc[i]->bus_code);
is_canceled = true;
}
if (is_canceled)
cout << "All reservation have been canceled succesfully!\n";
else
cout << "Operation was not successful, check name/bus code again!\n";
}
// mass destination reservation cancelling
void massDestReservation_cancel()
{
cout << "Enter a destination name: ";
string destinationName;
cin >> destinationName;
bool is_canceled = false;
for (int i = 0; i < resrv_counter; i++)
if (resrvd_acc[i]->destination == destinationName)
{
cancel_reservation(i, resrvd_acc[i]->dest_no, resrvd_acc[i]->bus_code);
is_canceled = true;
}
if (is_canceled)
cout << "All reservation have been canceled succesfully!\n";
else
cout << "Operation was not successful, check name/bus code again!\n";
}
void generate_report()
{
system("cls");
cout << "Date: ";
date_time();
cout << "Bus Code | payement Received | Seat Reserved" << endl;
for (int i = 0; i < 5; i++)
for (int j = 0; j < 2; j++)
{
cout << " " << bus_rg[i]->bus_cd[j] << right << setw(15);
if (bus_rg[i]->seatAvailble[j] < 100)
{
cout << bus_rg[i]->payement[j] << right << setw(15)
<< (100 - bus_rg[i]->seatAvailble[j]) << endl;
}
else
cout << "None" << right << setw(15)
<< "0" << endl;
}
cout << "Total reservation made: " << resrv_counter << endl;
cout << "Total Payement Received: " << total_payement_received << endl;
}