Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Using C++ Heaps Create a struct with: flight number, arrival/departure, time, source, destination. Generate all the arrivals and place them into a heap. Pull the
Using C++ Heaps
Create a struct with: flight number, arrival/departure, time, source, destination.
Generate all the arrivals and place them into a heap.
Pull the lowest time out.
If its arrival, output it and create a departure time. Re-insert it into the heap.
If its a departure, just output it
Background. Large airlines spend a great amount of effort to manage their hub airport. At DFW, for example, American Airlines serves about 50 Gates. Flights are arriving in "waves", filling up the gates. Then flights leave about 1 hour later, again one aircraft after the other. In this project you are to write a program which manages some of these issues. Scenario. When a flight arrives at a gate, we will consider this to be an event in time. Each aircraft's arrival will spawn another event, namely its departure exactly 60 minutes later. We will assume that randomly with probability 40% the departure is delayed by 20-40 Minutes, i.e the plane leaves 80-100 minutes after its arrival. (Waiting for baggage, weather, mechanical problens...) Problem. You will have to schedule the aircraft to the gates. Time is measured in minutes starting at time 0. Flight arrivals will be at minute 2: LAX continuing to JFK 4: IAH continuing to MSP 1T: SFO continuing to ORD 28: TUL continuing to ONT 37: BNA continuing to SEA 49: HOS continuing to DEN 3: SMF continuing to RDU 9: ABQ continuing to ATL 14: PHx continuing to MIA 19: SLC continuing to AUS 33: DCA continuing to LAS 44: MAF continuing to AMA 55: ELP continuing to MEM repeating every hour. Just to make the style look a little more realistic we will have flight numbers according to the following scheme: Flights are numbered consecutively stating at number 1000 for the very first flight (LAX to JFK at time 2), 1001 for the second (IAH to MSP at time 4) and 1014 for the first flight of the second hour and so forth What you have to provide is a list that gives the flight number with the assigned gate mumber. For convenience it should also give the arrival time and departure time (in minutes from 0). If a flight could not be assigned a gate, there should be a message "Airport full". (Obviously in the real world this is unacceptable.) The simulation should model 24 hours of operation. Implementation. The events are to be kept in a priority queue implemented by a heap. The available number of gates. d exactly one input token, the token will be the You may assume that the mumber of gates are reasonable, say between 10 and 40. The schedule of ts maybe hard-coded into the program code (so there is no need to read it from a file.) figh Background. Large airlines spend a great amount of effort to manage their hub airport. At DFW, for example, American Airlines serves about 50 Gates. Flights are arriving in "waves", filling up the gates. Then flights leave about 1 hour later, again one aircraft after the other. In this project you are to write a program which manages some of these issues. Scenario. When a flight arrives at a gate, we will consider this to be an event in time. Each aircraft's arrival will spawn another event, namely its departure exactly 60 minutes later. We will assume that randomly with probability 40% the departure is delayed by 20-40 Minutes, i.e the plane leaves 80-100 minutes after its arrival. (Waiting for baggage, weather, mechanical problens...) Problem. You will have to schedule the aircraft to the gates. Time is measured in minutes starting at time 0. Flight arrivals will be at minute 2: LAX continuing to JFK 4: IAH continuing to MSP 1T: SFO continuing to ORD 28: TUL continuing to ONT 37: BNA continuing to SEA 49: HOS continuing to DEN 3: SMF continuing to RDU 9: ABQ continuing to ATL 14: PHx continuing to MIA 19: SLC continuing to AUS 33: DCA continuing to LAS 44: MAF continuing to AMA 55: ELP continuing to MEM repeating every hour. Just to make the style look a little more realistic we will have flight numbers according to the following scheme: Flights are numbered consecutively stating at number 1000 for the very first flight (LAX to JFK at time 2), 1001 for the second (IAH to MSP at time 4) and 1014 for the first flight of the second hour and so forth What you have to provide is a list that gives the flight number with the assigned gate mumber. For convenience it should also give the arrival time and departure time (in minutes from 0). If a flight could not be assigned a gate, there should be a message "Airport full". (Obviously in the real world this is unacceptable.) The simulation should model 24 hours of operation. Implementation. The events are to be kept in a priority queue implemented by a heap. The available number of gates. d exactly one input token, the token will be the You may assume that the mumber of gates are reasonable, say between 10 and 40. The schedule of ts maybe hard-coded into the program code (so there is no need to read it from a file.) fighStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started