JAVA programming: Write an application that simulates a not-so-busy airport, whe
ID: 3569108 • Letter: J
Question
JAVA programming:
Write an application that simulates a not-so-busy airport, where different kinds of aircrafts, such as military and civilian helicopters, passenger airplanes, and military aircrafts, can take off and land.
According to wikipedia, "An aircraft is a machine that is able to fly by gaining support from the air...", which means they are all flyable.
These aircrafts have lots of common attaributes and behavior; however, they differ in how they:
fly - depending on their top speed, maximum elevation
take off - depending on their takeoff pattern (vertical, gradual horizontal), noise level (military aircrafts make more noise), length of distance required, increase in speed
land - depening on their landing pattern, noise level, and length of distance required (same as for take off); as well as decrease in speed
Write classes (both concrete and abstract) to implement the aircraft objects. Be sure to implement all necessary methods.
Write the Flyable interface.
The simulator class simulates (it is similar to a tester) the operation of this airport for one day.
It randomly creates different kinds of aircrafts and allows them to takeoff and land. The airport only handles two different helicopters, one passenger airplane, and one military aircraft every day.
Explanation / Answer
Consider a small busy "local-tour" airport with only one runway. In each unit of time one plane can land or one can take off, but not both, and thus, the runway could be either "idle" or "busy". Planes might be of 2 types:
1- Private planes (V) (fit maximum for 10 passengers )
2- Public planes (P) (fit maximum for 200 passengers)
Planes arriving to the airport are queued in one of 2 lines. (One for private planes (V), and another is for public planes (P)). Each fit a maximum of 3 planes.
The information about the arrival and departure of planes is found (sorted according to time) in file "input.dat" that has the following format: (Plane ID, Type of the plane[V or P], Arrival / Departure, Time of Arrival / Departure)
Example:
111 P A 8.00
211 P A 8.15
131 V A 8.30
111 P D 8.45
.
.
.
At any arrival or departure, the program should check if the runway is "idle" or "busy". If "idle", the plane is processed directly with no delay. If "busy", the plane would wait until the runway is idle, and the delay time should be reported.
Each plane carries a number of passengers. You need to suggest the best data structure to represent passengers in the planes. Each passenger can carry only one suit-case labeled by his name or ID into the plane. This information should be read from a separate file called
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.