-
Notifications
You must be signed in to change notification settings - Fork 1
/
Source.cpp
282 lines (273 loc) · 6.31 KB
/
Source.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
#include "Project.h"
#include <fstream>
#include <iostream>
#include <iomanip>
#include <windows.h>
//for reference only
void Menu() {
cout << "1. Add a new Customer" << endl;
cout << "2. Add or remove a Driver" << endl;
cout << "3. Add or remove a Vehicle" << endl;
cout << "4. Print List of All Customers" << endl;
cout << "5. Print List of All drivers" << endl;
cout << "6. Print complete list of vehicles with details by their category" << endl;
cout << "7. Print complete details and service history of a particular vehicle, (Provide vehicle ID)" << endl;
cout << "8. Print complete history of a particular customer, (Provide customer ID)" << endl;
cout << "9. Print complete history of a driver including services. (Provide driver ID)" << endl;
cout << "10. Print list of all drivers who have ranking above 4.5." << endl;
cout << "11. Print list of all drivers who have multiple licenses and their license information too" << endl;
cout << "13. Add a Service request (ride or delivery)" << endl;
cout << "14. Cancel a booking" << endl;
cout << "15. Complete a Service (Provide Service ID)" << endl;
cout << "16. Print details of all Customers, who used the same vehivle in a ride service on a different date" << endl;
cout << "17. Print List of all drivers who completed delvery services on same day" << endl;
cout << "18. Print details of all pending services on a particular date" << endl;
cout << "19. Print details of all pending services of a particular driver" << endl;
cout << "20. Print details of all cancelled services by a customer" << endl;
}
void showMenu(TMS &T) {
int choice;
a:
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 3);
cout << setw(100) << "------------------ Welcome To Travel Management System ------------------\n\n";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
cout << "1. Customers\n";
cout << "2. Drivers\n";
cout << "3. Vehicles\n";
cout << "4. Rides\n";
cout << "5. Deliveries\n";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 4);
cout << "0. Exit!\n\n";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
cout << "Enter choice: ";
cin >> choice;
switch (choice)
{
case 0:
break;
case 1:
b:
cout << "1. Add a Cusotmer\n";
cout << "2. Details of Specific Customer\n";
cout << "3. Details All Customers\n";
cout << "4. Details Customer who used same vehicle for a trip\n";
cout << "5. Pending Services on a Particular Date\n";
cout << "6. Cancelled Services By Customer\n";
cout << "0. Main Menu\n\n";
cout << "Enter choice: ";
cin >> choice;
switch (choice)
{
case 0:
goto a;
case 1:
T.addCustomer();
goto b;
break;
case 2:
T.displayCustomerWithID();
goto b;
break;
case 3:
T.displayAllCustomers();
goto b;
break;
case 4:
T.displayCustomerWithSameVehicle();
goto b;
break;
case 5:
T.displayAllPendingServicesOnDate();
goto b;
break;
case 6:
T.displayAllCancelledServicesByCustomer();
goto b;
break;
default:
cout << "Invalid Choice!\n\n";
goto b;
break;
}
break;
case 2:
c:
cout << "1. Add a Driver\n";
cout << "2. Remove a Driver\n";
cout << "3. Details of Specific Driver\n";
cout << "4. Details of Driver with Ranking > 4.5 \n";
cout << "5. Details of Driver with Multiple Licences \n";
cout << "6. Details of Driver with who Delivered on same Date \n";
cout << "7. Details of Pending Services by Particular Driver \n";
cout << "0. Main Menu!\n\n";
cout << "Enter choice: ";
cin >> choice;
switch (choice)
{
case 0:
goto a;
case 1:
T.addDriver();
goto c;
break;
case 2:
T.removeDriver();
goto c;
break;
case 3:
T.displayDriverWithID();
goto c;
break;
case 4:
T.displayDriversWithRank4_5();
goto c;
break;
case 5:
T.displayDriverWithMultipleLicence();
goto c;
break;
case 6:
T.displayDriverWhoDeliveredOnSameDate();
goto c;
break;
case 7:
T.displayAllPendingServicesbyDriver();
goto c;
break;
default:
cout << "Invalid Choice!\n\n";
goto c;
break;
}
break;
case 3:
d:
cout << "1. Add a Vehicle\n";
cout << "2. Remove a Vehicle\n";
cout << "3. Display All Vehicles\n";
cout << "4. Display Specfic Vehicle\n";
cout << "0. Main Menu!\n\n";
cout << "Enter choice: ";
cin >> choice;
switch (choice)
{
case 0:
goto a;
break;
case 1:
T.addVehicle();
goto d;
break;
case 2:
T.removeVehicle();
goto d;
break;
case 3:
T.displayAllVehicles();
goto d;
break;
case 4:
T.displayVehicleWithID();
goto d;
break;
default:
cout << "Invalid Choice!\n\n";
goto d;
break;
}
break;
case 4:
e:
cout << "1. Add a Ride\n";
cout << "2. Cancel a Ride\n";
cout << "3. Complete a Ride\n";
cout << "4. Display All Rides\n";
cout << "5. Display a Specific Ride\n";
cout << "0. Main Menu!\n\n";
cout << "Enter choice: ";
cin >> choice;
cin.ignore();
switch (choice)
{
case 0:
goto a;
break;
case 1:
T.addRide();
goto e;
break;
case 2:
T.cancelRide();
goto e;
break;
case 3:
T.completeRide();
goto e;
break;
case 4:
T.displayAllRides();
goto e;
break;
case 5:
T.displayRideWithID();
goto e;
break;
default:
cout << "Invalid Choice!\n\n";
goto e;
break;
}
break;
case 5:
f:
cout << "1. Add a Delivery\n";
cout << "2. Cancel a Delivery\n";
cout << "3. Complete a Delivery\n";
cout << "4. Display All Deliveries\n";
cout << "5. Display a Specific Delivery \n";
cout << "0. Main Menu!\n\n";
cout << "Enter choice: ";
cin >> choice;
cin.ignore();
switch (choice)
{
case 0:
goto a;
break;
case 1:
T.addDelivery();
goto f;
break;
case 2:
T.cancelDelivery();
goto f;
break;
case 3:
T.completeDelivery();
goto f;
break;
case 4:
T.displayAllDeliveries();
goto f;
break;
case 5:
T.displayDeliveryWithID();
goto f;
break;
default:
cout << "Invalid Choice!\n\n";
goto f;
break;
}
break;
default:
cout << "Invalid Choice!\n";
goto a;
break;
}
}
int main() {
TMS T(15,10,20);
showMenu(T);
return 0;
}