-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathProject.h
469 lines (400 loc) · 11 KB
/
Project.h
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
#pragma once
#include <fstream>
#include <string>
using namespace std;
class Name {
string fName;
string lName;
public:
Name();
Name(string fN, string lN);
Name(const Name&);
~Name();
void setFName(string);
void setLName(string);
string getFName();
string getLName();
friend ostream& operator<<(ostream&, const Name&);
friend ifstream& operator>>(ifstream&, Name&);
friend ofstream& operator<<(ofstream&, Name&);
friend istream& operator>>(istream&, Name&);
};
class Date {
int day;
int month;
int year;
public:
Date();
Date(int, int, int);
Date(const Date&);
~Date() {};
void setDay(int);
void setMonth(int);
void setYear(int);
int getDay();
int getMonth();
int getYear();
friend ostream& operator<<(ostream&, const Date&);
friend ifstream& operator>>(ifstream&, Date&);
friend ofstream& operator<<(ofstream&, const Date&);
friend istream& operator>>(istream&, Date&);
};
class mTime {
int hour;
int min;
int sec;
public:
mTime();
mTime(int, int, int);
mTime(const mTime&);
~mTime() {};
void setHour(int);
void setMin(int);
void setSec(int);
int getHour();
int getMin();
int getSec();
friend ostream& operator<<(ostream&, const mTime&);
friend ifstream& operator>>(ifstream&, mTime&);
friend ofstream& operator<<(ofstream&, const mTime&);
friend istream& operator>>(istream&, mTime&);
};
class Service {
string source;
string destination;
float distance; //in km
Date bookingDate;
mTime bookingTime;
int status; // 0 for pending, 1 if complete, 3 if cancelled
float fuelrate;
int cId; // Customer Id who booked the ride
int dId; // Driver Id
int vId; // vehicle Id
int sId; //service id
float fare; //fare
public:
Service();
Service(string, string, float, Date, mTime, int, float, int, int, int, int, float);
~Service();
void setSource(string);
void setDestination(string);
void setDistance(float);
void setBookingDate(Date);
void setBookingTime(mTime);
void setStatus(int);
void setFuelRate(float);
void setCId(int);
void setDId(int);
void setVId(int);
void setSId(int);
void setFare(float);
string getSource();
string getDestination();
float getDistance();
Date getBookingDate();
mTime getBookingTime();
int getStatus();
float getFuelRate();
int getCId();
int getDId();
int getVId();
int getSId();
float getFare();
friend ostream& operator<<(ostream&, Service&);
friend ifstream& operator>>(ifstream&, Service&);
friend ofstream& operator<<(ofstream&, const Service&);
friend istream& operator>>(istream&, Service&);
};
class Ride : public Service {
int noofPassengers; // false for pending, true if complete
string rideType; // intercity, intracity
float DriverRanking; // 0 to 5 scale (worst to best)
float VehicleRanking; // 0 to 5 scale (worst to best)
public:
Ride(string, string, float, Date, mTime, int, float, int, int, int, int,float, int, string, float, float);
void setNoofPassengers(int);
void setRideType(string);
void setDRank(float);
void setVRank(float);
int getNoofPassengers();
string getRideType();
float getDRank();
float getVRank();
~Ride();
friend ostream& operator<<(ostream&, Ride&);
friend ifstream& operator>>(ifstream&, Ride&);
friend ofstream& operator<<(ofstream&, const Ride&);
friend istream& operator>>(istream&, Ride&);
};
class Delivery : public Service {
float goodsWeight; // Weight of goods in Kg
string goodsType; //type of goods food, furniture, petroleum, chemicals, etc.
public:
Delivery(string, string, float, Date, mTime, int, float, int, int, int, int, float, float, string);
~Delivery();
void setGoodsWeight(float);
void setGoodsType(string);
float getGoodsWeight();
string getGoodsType();
friend ostream& operator<<(ostream&, Delivery&);
friend ifstream& operator>>(ifstream&, Delivery&);
friend ofstream& operator<<(ofstream&, const Delivery&);
friend istream& operator>>(istream&, Delivery&);
};
class Person {
private:
Name pName;
Date DOB;
int Age;
int Nid;
public:
Person();
Person(Name, Date, int, int);
Person(const Person&);
~Person() {};
void setName(Name);
void setDOB(Date);
void setAge(int);
void setID(int);
Name getName();
Date getDOB();
int getAge();
int getID();
friend ostream& operator<<(ostream&, const Person&);
friend istream& operator>>(istream&, Person&);
friend ofstream& operator<<(ofstream&, Person&);
friend ifstream& operator>>(ifstream&, Person&);
};
class Customer : public Person {
private:
int cId;
int noofBookings;
Service** bookingHistory;
public:
Customer();
Customer(Name, Date, int, int, int, Service**,int);
Customer(const Customer&);
~Customer();
void setCId(int);
void setHistorry(Service**,int);
int findHistory(int, int&);
void loadHistory(int);
int getCId();
int getNoofServices();
Service** getHistory();
friend ostream& operator<<(ostream&, Customer&);
friend istream& operator>>(istream&, Customer&);
friend ifstream& operator>>(ifstream&, Customer&);
friend ofstream& operator<<(ofstream&, Customer&);
};
class Driver : public Person {
private:
int dId;
char** LicencesList;
int noofLicences;
float overallRanking;
float salary;
int experience;
int status; // 1 for free, 2 if booked and 3 if cancelled
Service** serviceHistory;
int noofServices;
public:
Driver();
Driver(Name, Date, int, int, int, char**, int, float, float, int, int, Service**,int);
Driver(const Driver&);
~Driver();
void setDId(int);
void setLicenceList(char**,int);
void setNoofLicences(int);
void setRanking(float);
void setSalary(float);
void setExperience(int);
void setStatus(int);
void setHistory(Service**,int);
int getDId();
char** getLicenceList();
int getNoofLicences();
float getRanking();
float getSalary();
int getExperience();
int getStatus();
Service** getHistory();
int getNoofServices();
int findHistory(int, int&);
void loadHistory(int);
friend ostream& operator<<(ostream&, Driver&);
friend istream& operator>>(istream&, Driver&);
friend ofstream& operator<<(ofstream&, Driver&);
friend ifstream& operator>>(ifstream&, Driver&);
};
class Feature {
int fId;
string description;
float cost;
public:
Feature(int, string, float);
~Feature();
void setFId(int);
void setDescription(string);
void setCost(float);
int getFId();
string getDescription();
float getCost();
friend ostream& operator<<(ostream&, const Feature&);
friend istream& operator>>(istream&, Feature&);
friend ofstream& operator<<(ofstream&, Feature&);
friend ifstream& operator>>(ifstream&, Feature&);
};
class Vehicle {
int vId;
int registrationNo;
float avgMileage;
string LicenceType; // License required for driving the vehicle
bool status; // false for free, true if booked in a service already
string fueltype;
float overallRanking;
Date manufacturingDate;
Feature* list;
Service** serviceHistory;
int noofServices;
int noofFeatures;
public:
Vehicle(int, int, float, string, bool, string, float, Date, Feature*, Service**, int, int);
int getVId();
int getRegNo();
int getAvgMil();
string getLicenceType();
bool getStatus();
string getFuelType();
int getOverallRanking();
Date getManuDate();
Feature* getFeatList();
int getNoofFeatures();
Service** getServiceHistory();
int getNoofServices();
void setVId(int);
void setRegNo(int);
void setAvgMil(int);
void setLicenceType(string);
void setStatus(bool);
void setFuelType(string);
void setOverallRanking(int);
void setManuDate(Date);
void setFeatList(Feature*, int);
void setNoofFeatures(int);
void setServiceHistory(Service**, int);
int findHistory(int, int&);
void loadHistory(int);
~Vehicle();
friend ostream& operator<<(ostream&, Vehicle&);
friend istream& operator>>(istream&, Vehicle&);
friend ofstream& operator<<(ofstream&, Vehicle&);
friend ifstream& operator>>(ifstream&, Vehicle&);
};
//add Complete Hierarchy of vehicles based on their types and functions
//Ride Vehicle
class RideVehicle : public Vehicle {
public:
RideVehicle(int, int, float, string, bool, string, float, Date, Feature*, Service**, int, int);
};
//Transport Vehicle
class TransportVehicle : public Vehicle {
public:
TransportVehicle(int, int, float, string, bool, string, float, Date, Feature*, Service**, int, int);
};
//RideTrans Vehicle
class RideTransVehicle : public Vehicle {
public:
RideTransVehicle(int, int, float, string, bool, string, float, Date, Feature*, Service**, int, int);
};
//SmallRide Vehicle
class SmallRideVehicle : public RideVehicle
{
public:
SmallRideVehicle(int, int, float, string, bool, string, float, Date, Feature*, Service**, int, int);
};
//LargeRide Vehicle
class LargeRideVehicle : public RideVehicle
{
public:
LargeRideVehicle(int, int, float, string, bool, string, float, Date, Feature*, Service**, int, int);
};
//LightTrans Vehicle
class LightTransVehicle : public TransportVehicle
{
public:
LightTransVehicle(int, int, float, string, bool, string, float, Date, Feature*, Service**, int, int);
};
//HeavyTrans Vehicle
class HeavyTransVehicle : public TransportVehicle
{
public:
HeavyTransVehicle(int, int, float, string, bool, string, float, Date, Feature*, Service**, int, int);
};
class TMS
{
int totalCustomers;
int totaldDrivers;
int totalVehicles;
int totalRides;
int totalDeliveries;
int availableCustomers;
int availableDrivers;
int availableVehicles;
int availableRides;
int availableDeliveries;
Customer** Customers;
Driver** Drivers;
Vehicle** Vehicles;
Ride** Rides;
Delivery** Deliveries;
public:
TMS(int, int, int);
~TMS();
void addCustomer();
void loadCustomers();
void displayAllCustomers();
void displayCustomerWithID();
void displayCustomerWithSameVehicle();
void displayAllCancelledServicesByCustomer();
void loadDrivers();
void addDriver();
bool isDriverFound(int);
void removeDriver();
void displayAllDrivers();
void displayDriversWithRank4_5();
void displayDriversWithRank();
void displayDriverWithID();
void displayDriverWithMultipleLicence();
void displayDriverWhoDeliveredOnSameDate();
void writeDrivers();
void loadVehicles();
void addVehicle();
bool isVehicleFound(int);
void removeVehicle();
void displayVehicleWithID();
void displayAllVehicles();
void writeVehicle();
void loadRides();
void addRide();
void displayAllRides();
void displayRideOfUser(int);
void displayRideOfDriver(int);
void displayRideOfVehicle(int);
void completeRide();
void cancelRide();
void writeRides();
void displayRideWithID();
void loadDeliveries();
void addDelivery();
void displayAllDeliveries();
void displayDeliveryOfUser(int);
void displayDeliveryOfDriver(int);
void displayDeliveryOfVehicle(int);
void completeDelivery();
void cancelDelivery();
void writeDelivery();
void displayDeliveryWithID();
void displayAllPendingServicesOnDate();
void displayAllPendingServicesbyDriver();
};