Assignment 02
Assignment 02
Assignment 02
The airport simulator is a turn based simulator. Within each turn a number of events, specified
below, occur. A clock (an integer) is kept to track the number of turns. Each turn takes one clock
tick. Your simulator needs to determine which planes land and take off at each turn.
A plane may be sitting on the ground waiting to take off or a plane may be in the air waiting to
land. The planes in the air have a nonnegative integer amount of fuel. During each turn the fuel
of each in air plane is reduced by one. Once a plane in the air reaches zero fuel that plane must
land before the next turn or that plane will crash. This allows planes to land in priority order
(zero fuel has highest priority, 1 unit has the next priority, etc.).
A non-priority queue must be used to track planes waiting to take off. Planes take off in the order
in which they entered the system.
The airport has one runway. During each turn, runway lands exactly one plane or allows exactly
one plane to take off. Runway may not both land and launch a plane in the same turn. Runway
may also sit idle for a turn if no plane needs to land or take off.
Data File
The data file is guaranteed to not be corrupt or invalid. Zeros in various spots are valid. Airplane
crashes do not mean your simulation is not working. If your airport simulator crashes that is an
entirely different story.
Each line in the data file contains the following integers, separated by a single space, in this
order: