This problem is to simulate an airport landing and takeoff pattern. The
airport has 3 runways, runway 1, runway 2 and runway 3. There are 4
landing holding patterns, two for each of the first two runways. Arriving
planes will enter one of the holding pattern queues, where the queues are
to be as close in size as possible. When a plane enters a holding queue, it
is assigned an integer ID number and an integer giving the number of time
units the plane can remain in the queue before it must land (because of low
fuel level). There is also a queue for takeoffs for each of the three
runways. Planes arriving in a takeoff queue are also assigned an integer ID.
The takeoff queues should be kept the same size.
At each time 03 planes may arrive at the landing queues and 03 planes may
arrive at the takeoff queues. Each runway can handle one takeoff or landing
at each time slot. Runway 3 is to be used for takeoffs except when a plane
is low on fuel. At each time unit, planes in either landing queue whose
air time has reached zero must be given priority over other landings and
takeoffs. If only one plane is in this category, runway 3 is to be used. If
more than one, then the other runways are also used (at each time at most
3 planes can be serviced in this way).
Use successive even(odd) integers for ID's of planes arriving at takeoff
(landing) queues. At each time unit assume that arriving planes are entered
into queues before takeoffs or landings occur. Try to design your algorithm
so that neither landing nor takeoff queues grow excessively. However,
arriving planes must be placed at the ends of queues. Queues cannot be
reordered.
The output should clearly indicate what occurs at each time unit.
Periodically print (a) the contents of each queue; (b) the average takeoff
waiting time; (c) the average landing waiting time; (d) the average flying
time remaining on landing; and (e) the number of planes landing with no fuel
reserve. (b)(c) are for planes that have taken off or landed respectively.
The output should be self explanatory and easy to understand(and uncluttered).
The input should be in a file generated by using random number generator.
For each time unit the input is of the form:
<# of planes arriving at takeoff queues(03)><# of planes arriving at landing
queues(03)><units of flying time (120) for planes arriving in landing queues>*
Number of planes arriving at landing and takeoff queues is an integer between
0 to 3. Units of flying time is an integer between 1 and 20 and there are
as many numbers as the number of planes arriving in landing queues.
Instructions
. Use only Linux and gcc.
