-
Notifications
You must be signed in to change notification settings - Fork 0
/
interface.h
148 lines (116 loc) · 2.8 KB
/
interface.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
/******************************************************
Change log:
3.0
Added getter to Date class
Virtual destructor to ID class
*******************************************************/
#ifndef INTERFACE_H
#define INTERFACE_H
#include <map>
#include <list>
#include <string>
using namespace std;
enum Jobs {MANAGER, NAVIGATOR, FLY_ATTENDANT, PILOT, OTHER};
enum Classes {FIRST_CLASS, SECOND_CLASS};
class ID
{
public:
virtual string getID() = 0;
virtual ~ID(){}
};
class Employee;
class Plane;
class Flight;
class Customer;
class Reservation;
class Date;
class Employee : public ID
{
public:
virtual int getSeniority() = 0;
virtual int getBirthYear() = 0;
virtual Employee* getEmployer() = 0;
virtual Jobs getTitle() = 0;
virtual ~Employee(){}
};
class Plane : public ID
{
public:
virtual int getModelNumber() = 0;
virtual map<Jobs, int> getCrewNeeded() = 0;
virtual int getMaxFirstClass() = 0;
virtual int getMaxEconomyClass() = 0;
virtual ~Plane(){}
};
class Flight : public ID
{
public:
virtual int getModelNumber() = 0;
virtual list<Reservation*> getReservations() = 0;
virtual list<Employee*> getAssignedCrew() = 0;
virtual Date getDate() = 0;
virtual string getSource() = 0;
virtual string getDestination() = 0;
virtual ~Flight(){}
};
class Customer : public ID
{
public:
virtual string getFullName() = 0;
virtual int getPriority() = 0;
virtual list<Reservation*> getReservations() = 0;
virtual ~Customer(){}
};
class Reservation : public ID
{
public:
virtual Customer* getCustomer() = 0;
virtual Flight* getFlight() = 0;
virtual Classes getClass() = 0;
virtual int getMaxBaggage() = 0;
virtual ~Reservation(){}
};
class Date
{
string date;
public:
string getDate() const {return date;}
Date(string date); // format: YYYY-MM-DD
bool operator<(const Date& d) const;
bool operator>(const Date& d) const;
bool operator==(const Date& d) const;
};
class Ex2
{
public:
virtual Employee* addEmployee(
int seniority,
int birth_year,
string employer_id,
Jobs title) = 0;
virtual Employee* getEmployee(string id) = 0;
virtual Plane* addPlane(
int model_number,
map<Jobs, int> crew_needed,
map<Classes, int> max_passangers) = 0;
virtual Plane* getPlane(string id) = 0;
virtual Flight* addFlight(
int model_number,
Date date,
string source,
string destination) = 0;
virtual Flight* getFlight(string id) = 0;
virtual Customer* addCustomer(
string full_name,
int priority) = 0;
virtual Customer* getCustomer(string id) = 0;
virtual Reservation* addResevation(
string customerId,
string flightId,
Classes cls,
int max_baggage) = 0;
virtual Reservation* getReservation(string id) = 0;
virtual void exit() = 0;
virtual ~Ex2(){}
};
#endif