1+ /*
2+ MIT License
3+
4+ Copyright (c) 2022 m!haly4
5+
6+ Permission is hereby granted, free of charge, to any person obtaining a copy
7+ of this software and associated documentation files (the "Software"), to deal
8+ in the Software without restriction, including without limitation the rights
9+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+ copies of the Software, and to permit persons to whom the Software is
11+ furnished to do so, subject to the following conditions:
12+
13+ The above copyright notice and this permission notice shall be included in all
14+ copies or substantial portions of the Software.
15+
16+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+ SOFTWARE.
23+ */
24+
25+ #pragma once
26+ #include < iostream>
27+ #include < string>
28+ #include < vector>
29+
30+ class Human
31+ {
32+ private:
33+ std::string name;
34+ std::string surname;
35+
36+ int age;
37+ std::string sex;
38+ int number_of_children;
39+ bool the_presence_of_children;
40+
41+ public:
42+ Human ();
43+ ~Human ();
44+
45+ // setters
46+ void setName (std::string name);
47+ void setSurname (std::string surname);
48+ void setAge (int age);
49+ void setSex (std::string sex);
50+ void setNumOfChildren (int num);
51+ void setThePresenceOfChildren (bool ch);
52+
53+ // getters
54+ std::string getName ();
55+ std::string getSurname ();
56+ int getAge ();
57+ std::string getSex ();
58+ int getNumOfChildren ();
59+ bool getThePresenceOfChildren ();
60+
61+ void output (Human &el);
62+ };
63+
64+ class Passenger : public Human
65+ {
66+ private:
67+ std::string route;
68+ std::string depDate;
69+ std::string depAbroadDate;
70+ std::string luggage;
71+ public:
72+ Passenger ();
73+ Passenger (std::string name, std::string surname, int age, std::string sex,
74+ std::string route, std::string depDate, std::string depAbroadDate, std::string luggage);
75+ ~Passenger ();
76+
77+ // setters
78+ void setRoute (std::string route);
79+ void setDepDate (std::string date);
80+ void setDepAbroadDate (std::string date);
81+ void setLuggage (std::string luggage);
82+
83+ // getters
84+ std::string getRoute ();
85+ std::string getDepDate ();
86+ std::string getDepAbroadDate ();
87+ std::string getLuggage ();
88+
89+ // function for outputting data
90+ void outputPass (Passenger &el);
91+ };
92+
93+ class Worker : public Human
94+ {
95+ private:
96+ double salary;
97+ int experience;
98+ std::string department;
99+
100+ public:
101+ Worker ();
102+ Worker (std::string name, std::string surname, int age,
103+ std::string sex, int number_of_children, bool the_presence_of_children,
104+ double salary, int experience, std::string department);
105+ ~Worker ();
106+
107+ // setters
108+ void setSalary (double salary);
109+ void setExperience (int experience);
110+ void setDepartment (std::string department);
111+
112+ // getters
113+ double getSalary ();
114+ int getExperience ();
115+ std::string getDepartment ();
116+
117+ // function for outputting data
118+ void output (Worker &el);
119+ };
120+
121+ class Administration : public Worker
122+ {
123+ private:
124+ std::string position;
125+
126+ public:
127+ Administration ();
128+ Administration (std::string name, std::string surname, int age,
129+ std::string sex, int number_of_children, bool the_presence_of_children,
130+ double salary, int experience, std::string department, std::string position);
131+ ~Administration ();
132+
133+ // setters
134+ void setPosition (std::string position);
135+
136+ // getters
137+ std::string getPosition ();
138+
139+ // function for outputting data
140+ void output (Administration &el);
141+ };
142+
143+ class Rolling_stock_driver : public Worker
144+ {
145+ private:
146+ int year_of_medical_examination;
147+
148+ public:
149+ Rolling_stock_driver ();
150+ Rolling_stock_driver (std::string name, std::string surname, int age,
151+ std::string sex, int number_of_children, bool the_presence_of_children,
152+ double salary, int experience, std::string department, int year_of_medical_examination);
153+ ~Rolling_stock_driver ();
154+
155+ // setters
156+ void setYearOfMed (int year_of_medical_examination);
157+
158+ // getters
159+ int getYearOfMed ();
160+
161+ // function for outputting data
162+ void output (Rolling_stock_driver &el);
163+ };
164+
165+ class Ticket
166+ {
167+ private:
168+ std::string route;
169+ double ticketPrice;
170+ public:
171+ Ticket (std::string route, double price)
172+ {
173+ this ->route = route;
174+ this ->ticketPrice = price;
175+ }
176+
177+ // setters
178+ void setRoute (std::string route);
179+ void setTicketPrice (double price);
180+
181+ // getters
182+ std::string getRoute ();
183+ double getTicketPrice ();
184+ };
185+
186+ class Locomotive ;
187+ class Vagon ;
188+
189+ class Train
190+ {
191+ private:
192+ std::string route;
193+ int serialNum;
194+ int workspaceNum;
195+ int dateOfProd;
196+ int maxspeed;
197+ std::string brand;
198+ std::string fuel;
199+ int numOfRoutes;
200+ int numOfRoutesBeforeRepair;
201+ int numOfRepair;
202+ std::string dateOfComeBack;
203+ int daysOnStation;
204+ std::string yearOfTechExam;
205+ std::string routeStatus;
206+ std::string routeReason;
207+ std::string category;
208+ int routeDuration;
209+ int numOfSoldTickets;
210+ int numOfHandedTickets;
211+ int totalNumOfTickets;
212+
213+ public:
214+ Train ();
215+ ~Train ();
216+
217+ // setters
218+ void setSerialNum (int num);
219+ void setWorkspaceNum (int num);
220+ void setDateOfProd (int date);
221+ void setMaxSpeed (int max);
222+ void setBrand (std::string brand);
223+ void setFuel (std::string fuel);
224+ void setNumOfRoutes (int routes);
225+ void setNumOfRoutesBeforeRepair (int routesBeforeRepair);
226+ void setNumOfRepair (int numOfRepair);
227+ void setDateOfComeback (std::string date);
228+ void setDaysOnStation (int days);
229+ void setYearOfTechExam (std::string year);
230+ void setRouteStatus (std::string status);
231+ void setRouteReason (std::string reason);
232+ void setCategory (std::string category);
233+ void setRouteDuration (int duration);
234+ void setRoute (std::string route);
235+ void setNumOfHandedTickets (int num);
236+ void setNumOfSoldTickets (int num);
237+ void setTotalNumOfTickets (int num);
238+
239+
240+ // getters
241+ int getSerialNum ();
242+ int getWorkspaceNum ();
243+ int getDateOfProd ();
244+ int getMaxSpeed ();
245+ std::string getBrand ();
246+ std::string getFuel ();
247+ int getNumOfRoutes ();
248+ int getNumOfRoutesBeforeRepair ();
249+ int getNumOfRepair ();
250+ std::string getDateOfComeback ();
251+ int getDaysOnStation ();
252+ std::string getYearOfTechExam ();
253+ std::string getRoute ();
254+ std::string getRouteStatus ();
255+ std::string getCategory ();
256+ int getRouteDuration ();
257+ std::string getRouteReason ();
258+ int getNumOfHandedTickets ();
259+ int getNumOfSoldTickets ();
260+ int getTotalNumOfTickets ();
261+ };
262+
263+ class Locomotive : public Train
264+ {
265+
266+ public:
267+ Locomotive ();
268+ Locomotive (int serialNum, int workspaceNum, int dateOfProd, int maxspeed,
269+ std::string brand, std::string fuel, int numOfRoutes, int numOfRoutesBeforeRepair,
270+ int numOfRepair, std::string dateOfComeBack, int daysOnStation, std::string yearOfTechExam,
271+ std::string routeStatus, std::string routeReason, std::string category, int routeDuration,
272+ std::string route, int numOfSoldTickets, int numOfHandedTickets, int totalNumOfTick);
273+ ~Locomotive ();
274+
275+ void outputLoc (Locomotive &el);
276+ };
277+
278+ class Vagon : public Locomotive
279+ {
280+ public:
281+ Vagon ();
282+ Vagon (int serialNum, int workspaceNum, int dateOfProd,
283+ std::string brand, int numOfRoutes, int numOfRoutesBeforeRepair,
284+ int numOfRepair, std::string dateOfComeBack, int daysOnStation, std::string yearOfTechExam);
285+ ~Vagon ();
286+
287+ void outputVag (Vagon &el);
288+ };
289+
290+ #include " function.hpp"
0 commit comments