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
|
#include <iostream>
using namespace std;
const unsigned short components = 100;
class Vehicle{
protected:
string type, regNumber, make, model;
float kilomiters;
unsigned short capacity;
char wheelchair;
bool booked;
public:
void changeStatus(){booked = true;};
Vehicle (string t, string reg, string mak, string mod, float kil, unsigned short cap, char wheel, bool b){type = t; regNumber = reg; make = mak;
model = mod; kilomiters = kil; capacity = cap; wheelchair = wheel; booked = b;};
};
class Journey: public Vehicle{
protected:
string fareID, returnTime;
float length;
public:
bool checkAvalibility();
};
class Person{
protected:
string name, phoneNo;
public:
};
class Customer: virtual public Person{
protected:
string source, destination, pickUpTime;
unsigned short numOfPeople;
bool wheelChair;
public:
void getDetails();
};
class Driver: virtual public Person{
protected:
string idNum, address, licenceDate,licenceType;
float kilomiters;
bool booked;
public:
void changeStatus(){booked = true;};
Driver (string nam, string ph, string id, string add, string licenceD, string licenceT, float kil, bool b){name = nam; phoneNo = ph; idNum = id;
address = add; licenceDate = licenceD; licenceType = licenceT; kilomiters = kil; booked = b;};
};
class Report: public Journey, public Customer, public Driver{
private:
float totalRevenueVehicle, totalRevenueDriver, totalKilomitersDriver, totalKilomitersVehicle;
public:
void printReport();
float calculateRevenue();
float calculateKilomiters();
};
int main(){
Driver driver1("Tom Daly", "087-6543210", "1234567A", "14 Green St., Cork", "12/08/2008", "B", 23231, false);
Driver driver2("Anne O'Brien", "086-5432109", "2345678B", "\"Beach View\", Kinsale", "09/12/2011", "D", 11980, false);
Driver driver3("James Twomey", "085-4321098", "3456789B", "14, French St., Cork", "14/11/2010", "D1", 18414, false);
Driver driver4("Mary O'Neill", "089-8765432", "4567890C", "23 Castle Road, Youghal", "11/02/2014", "B", 12669, false);
Driver driver5("Brendan Brown", "083-2109876", "5678901D", "98 Nuns Walk, Cork", "01/04/2007", "D", 23864, false);
Driver driver6("Vincent Coy", "087-8901234", "6789012E", "\"Green Valley\", Cobh", "03/04/1998", "D1", 3416, false);
Vehicle vehicle1("Taxi", "12 C 4956", "Hyundai", "i30 Tourer", 65172, 4, 'Y', false);
Vehicle vehicle2("Taxi", "14 C 89365", "Ford", "Mondeo", 33892, 4, 'Y', false);
Vehicle vehicle3("Taxi", "15 C 46046", "VW", "Passat", 23897, 4, 'Y', false);
Vehicle vehicle4("Taxi", "14 C 38492", "Nissan", "Primera", 29418, 4, 'Y', false);
Vehicle vehicle5("Taxi", "10 C 99393", "Skoda", "Octavia", 29418, 4, 'Y', false);
Vehicle vehicle6("Taxi", "15 C 2379", "Seat", "Toledo", 12812, 4, 'Y', false);
Vehicle vehicle7("Bus", "10 C 37209", "Ace", "Cougar", 28786, 48, 'Y', false);
Vehicle vehicle8("Bus", "11 C 882", "Daimler", "Fleetline", 68893, 48, 'N', false);
Vehicle vehicle9("Minibus", "14 C 23908", "Ford", "Transit", 18827, 16, 'Y', false);
Vehicle vehicle10("Minibus", "10 C 831", "Fiat", "Ducato", 31986, 16, 'Y', false);
Vehicle vehicle11("Minibus", "13 C 82677", "Mercedes-Benz", "Mercedes-Benzario", 18567, 20, 'N', false);
return 0;
}
|