Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Using Java language, program an airport simulator. The airport has one runway, and a plane can either be taking off or landing on it
Using Java language, program an airport simulator. The airport has one runway, and a plane can either be taking off or landing on it at any given unit of time. Each time your loop iterates represents unit of time. In each time unit, you need to: 1. Randomly decide if a plane should join the take-off queue 2. Randomly decide if a plane should join the landing priority queue Planes should arrive on average of about one every 3-6 units of time. Any plane joining the landing priority queue should have a random amount of remaining fuel assigned to it. This should range from 5 to 15 time-units of fuel left. Each unit of time, the amount of fuel left should decrement. If a plane's fuel reaches 0, it crashes. The planes should sort in the priority queue by placing those with the least amount of fuel at the front. Each plane takes 2 units of time to land and 3 units of time to take off. While a plane is landing or taking off, the runway is in use, and no other plane is allowed on the runway. When the runway is done being used, the landing priority queue is checked. If it contains any planes, the next one is selected to land. If there are no planes in the landing queue, the next plane in line to take off may do so. When a plane is selected to take off, no other planes should be allowed to take off or land until that plane is done. You will need to program your own priority queue by using a linked list. Please add comments in your code.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Heres a Java program implementing the airport simulator as per your requirements Ill use a priority queue implemented with a linked list java import j...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