-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
292 lines (258 loc) · 8.66 KB
/
main.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
283
284
285
286
287
288
289
290
291
292
//
// main.cpp
// Homework MeanGreen airlines
//
// Created by Aashish Pandey on 11/13/17.
// Copyright © 2017 Aashish Pandey. All rights reserved.
//
/* Name: Aashish Pandey
Course: CSCE 1040
Instructor: Prof David Keathly
Date: 11/13/2017
Description: This Program creates a flight scheduling for crewmember and plane in mean green airlines. And also lets the user print and edit the different details of plane, crewmembers and flight.
*/
#include <iostream>
#include <string>
#include "Planes.h" //including the header files
#include "CrewMembers.h"
#include "Flights.h"
void PressEnterToContinue();
void PrintMenu(); //print the intital menu options
void PlaneMenu(); //print the menu options for working with plane
void CrewMemberMenu(); //prints the menu options for working with crew members
void FlightMenu(); //prints the menu options for working with Flights
Planes planelist; //object for class Planes
CrewMembers crewlist; //object for class CrewMembers
Flights flightlist; // object for class Flights
int main()
{
string tail_number; //declaring and initialing the variables
string crewmember_id;
int MenuChoice = 0;
char PlaneOptions = 'g';
char CrewOptions = 'g';
char FlightOptions = 'g';
// for inital display of my and department information at first of the output
cout << "+---------------------------------------------------+" << endl;
cout << "| Computer Science and Engineering |" << endl;
cout << "| CSCE 1040 - Computer Science |" << endl;
cout << "|Aashish Pandey 11225327 [email protected] |" << endl;
cout << "+---------------------------------------------------+" << endl;
// providing user the list of menu items and and asking what they want to do
while (MenuChoice != 4)
{
PrintMenu(); //void function to pring the menu options
cout << "\n\nEnter your Choice :::::::::: ";
cin >> MenuChoice;
switch (MenuChoice)
{
case 1:
{
while (PlaneOptions != 'f')
{
PlaneMenu();
cout << "\n\n Enter your choice:::::";
cin >> PlaneOptions;
switch (PlaneOptions)
{
case 'a':
{
planelist.AddPlaneToList(); //adding plane to the list
PressEnterToContinue();
break;
}
case 'b':
{
planelist.EditPlane(); //editing the details of plane
PressEnterToContinue();
break;
}
case 'c':
{
planelist.DeletePlane(); //deleting the plane from the list
PressEnterToContinue();
break;
}
case 'd':
{
planelist.PrintList(); //printing the list of plane
PressEnterToContinue();
break;
}
case 'e':
{
planelist.PrintDetailsofPlane(); //printing details of a single plane
PressEnterToContinue();
break;
}
case 'f':
{
break;
}
}
}
}
case 2:
{
while (CrewOptions != 'f')
{
CrewMemberMenu();
cout << "\n\n Enter your choice:::::";
cin >> CrewOptions;
switch (CrewOptions)
{
case 'a':
{
crewlist.AddCrewMemberToList(); //adding crew member to the list
PressEnterToContinue();
break;
}
case 'b':
{
crewlist.EditCrewMember(); //editing the details of a crew member
PressEnterToContinue();
break;
}
case 'c':
{
crewlist.DeleteCrewMember(); //deleting a crew member from the list
PressEnterToContinue();
break;
}
case 'd':
{
crewlist.PrintCrewList(); //printing the list of the crew members in collection
PressEnterToContinue();
break;
}
case 'e':
{
crewlist.PrintDetailsofCrewMember(); //Printing the details of a crew member
PressEnterToContinue();
break;
}
case 'f':
{
break; //go back
}
}
}
}
case 3:
{
while (FlightOptions != 'h')
{
FlightMenu();
cout << "\n\n Enter your choice:::::";
cin >> FlightOptions;
switch (FlightOptions)
{
case 'a':
{
flightlist.AddFlightToList(planelist); //adding flight to list
PressEnterToContinue();
break;
}
case 'b':
{
flightlist.EditFlight(); //editing the details of a flight
PressEnterToContinue();
break;
}
case 'c':
{
flightlist.EditFlight(); //deleting the flight from the list
PressEnterToContinue();
break;
}
case 'd':
{
flightlist.PrintAll(); //printing the list of plane
PressEnterToContinue();
break;
}
case 'e':
{
flightlist.PrintDetailsofFlight(); //printing details of a single flight
PressEnterToContinue();
break;
}
case 'f':
{
flightlist.PrintListFlightofaPlane(); //printing the list of flights for a plane
PressEnterToContinue();
break;
}
case 'g':
{
//flightlist.PrintListofFlightsofaCrewMember();//printing the list of flights for a crew member
PressEnterToContinue();
break;
}
case 'h':
{
break;
}
}
}
}
break;
}
}
return 0;
}
//function for initial display of menu options
void PrintMenu()
{
cout << endl
<< "::::::Please choose the menu options::::::" << endl;
cout << "1. Working with Plane" << endl;
cout << "2. Working with Crew Members" << endl;
cout << "3. Working with Flights" << endl;
cout << "4. Quit" << endl;
}
void PressEnterToContinue()
{
string x;
cout << "\n Press 1 to continue...\n"
<< endl;
cin >> x;
}
//function for menu options for working with plane
void PlaneMenu()
{
cout << endl
<< ":::::Please choose the options:::::" << endl;
cout << "a. Add a Plane to the list" << endl;
cout << "b. Edit a Plane" << endl;
cout << "c. Delete a Plane" << endl;
cout << "d. Print the List of Planes" << endl;
cout << "e. Print the details of a Plane" << endl;
cout << "f. GoBack" << endl;
}
//menu options for working with crew members
void CrewMemberMenu()
{
cout << endl
<< ":::::Please choose the options:::::" << endl;
cout << "a. Add a Crew Member to the list" << endl;
cout << "b. Edit a Crew Member" << endl;
cout << "c. Delete a Crew Member" << endl;
cout << "d. Print the List of Crew Member" << endl;
cout << "e. Print the details of a Crew Member" << endl;
cout << "f. GoBack" << endl;
}
//menu options for working with flights
void FlightMenu()
{
cout << endl
<< ":::::Please choose the options:::::" << endl;
cout << "a. Add a Flight to the list" << endl;
cout << "b. Edit a Flight " << endl;
cout << "c. Delete a Flight " << endl;
cout << "d. Print the List of Flights" << endl;
cout << "e. Print the details of a Flight " << endl;
cout << "f. Print all the flights of a plane" << endl;
cout << "g. Print all the flights for a crew member" << endl;
cout << "h. GoBack" << endl;
}