We would like to begin designing an airline management system. You are the programmer and (along with many other people) you will be working on individual components of the airline system.
Let’s start with the basics:
The airline has a number of flights operating each day. The flights operate with a unique number (the flight number), depart from one city and arrive at another city. It generally takes the same amount of time to fly a route, but occasionally takes longer due to weather, traffic or passenger delays. You should design a class (Flight) which stores the data for these flights. It will contain those four items and they can all be public for now.
The data must be recovered from a file (hw4data.txt) which will contain those four items in a row, separated by tabs. The file is given and a sample is below. To explain, Flight 120 is scheduled from KMSY (Airport code for New Orleans) to KJFK (Airport code for… well… JFK), that flight is expected to take 148 minutes to fly; flight 1218 goes from KBUF (Buffalo) to KBOS (Boston) and will take just 66 minutes.
120 KMSY KJFK 148
1218 KBUF KBOS 66
1224 KRDU KBOS 85
1294 KPIT KBOS 74
1310 KIAD KJFK 48
You are expected to store the same data three times. Once in a Map which associates the flight number to the data, again in a multimap associating the Departure airport to the flight and again in a multimap associating the Destination to the flight.
map<int, Flight> # Flight number : Flight object pairs
multimap<string, Flight> # Departure String : Flight object pairs
multimap<string, Flight> # Arrival String : Flight object pairs
Design a function which can accept the multimap and a departure airport and a will return a vector listing the flight numbers departing from that airport.
Design a function which can accept the multimap and a destination airport and will return a vector listing the flight numbers arriving at that airport.
Input:
120 KMSY KJFK 148
1218 KBUF KBOS 66
1224 KRDU KBOS 85
1294 KPIT KBOS 74
1310 KIAD KJFK 48
137 KJFK KRSW 163
1401 KAUS KSFO 212
1417 KAUS KLGB 169
144 KPBI KJFK 125
1717 KMCO MDSD 138
173 KJFK KSJC 321
182 KSAN KJFK 300
194 KLAS KJFK 272
198 KLAS KJFK 281
202 KLGB KJFK 304
21 KJFK KTPA 155
215 KJFK KLGB 310
217 KJFK KLGB 311
233 KSLC KLGB 91
250 KLGB KOAK 64
264 KLGB KSMF 64
276 KSAN KSEA 138
28 KTPA KJFK 130
295 KSEA KLGB 147
307 KIAD KLGB 283
317 KIAD KOAK 295
33 KROC KJFK 51
354 KBUR KJFK 299
357 KJFK KBUR 311
359 KJFK KBUR 308
366 KPBI KLGA 137
378 KFLL KLGA 133
411 KBOS KSAN 336
433 KBOS KMCO 166
436 KMCO KBOS 149
447 KBOS KTPA 182
458 KFLL KBOS 154
47 KJFK KFLL 177
483 KBOS KLAS 303
489 KBOS KLGB 338
491 KBOS KDEN 240
497 KBOS KSEA 340
510 KFLL KEWR 143
566 KFLL KSWF 152
586 KFLL KHPN 146
598 KMCO KHPN 128
629 KJFK KHOU 197
644 KSFO KJFK 309
647 KJFK KSFO 319
704 TJSJ KJFK 204
745 KMCO TJSJ 152
746 KMCO KEWR 126
782 MDSD KJFK 202
796 MDST KJFK 202
87 KJFK KSLC 260
91 KJFK KOAK 321
922 KORD KBOS 113
937 KORD KLGB 223
95 KJFK KOAK 324
96 KOAK KJFK 311
97 KJFK KDEN 221
Expected output:
Flights departing from KLAS:
194
198
Flights arriving at KLAS:
120
1310
144
182
194
198
202
28
33
354
644
704
782
796
96