Using Java language, program an airport simulator. The airport has one runway, and a plane can...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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. 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.
Expert Answer:
Related Book For
Microeconomics An Intuitive Approach with Calculus
ISBN: 978-0538453257
1st edition
Authors: Thomas Nechyba
Posted Date:
Students also viewed these programming questions
-
CANMNMM January of this year. (a) Each item will be held in a record. Describe all the data structures that must refer to these records to implement the required functionality. Describe all the...
-
Managing Scope Changes Case Study Scope changes on a project can occur regardless of how well the project is planned or executed. Scope changes can be the result of something that was omitted during...
-
Jogger 1 is travelling east at 6 . 5 m / s and has a mass of 8 2 kg . Jogger 2 is travelling north at 5 . 8 m / s and has a mass of 5 4 . 5 kg . One of the joggers has their head down and doesnt see...
-
Mark and Sheila from Problem 8-1 are trying to apply their understanding of the security market line concept to the analysis of their real estate investment strategy. They estimate that their...
-
In your search for the best rate on a new-car loan, you note that various lenders quote rates with differing compounding frequencies. Your car dealer offers financing at 7.5% compounded monthly. For...
-
Explain the primary activities of the (a) timekeeping and (b) payroll departments.
-
1. What external and internal pressures did Mark Parker face when he assumed the leadership of Nike, and how did he respond to these challenges? 2. Strategic management is about formulating...
-
Q6: Capacity Planning - Capacity Levels (3 Marks) If you know that Zayed's branch operations at PRIMO's Pizza are designed to operate 16 hours a day. In addition, across the whole year, there will be...
-
Harold earns a salary of $200,000 from EMK enterprises as an officer during this year for the first 11 months of the year. Harold withholds OASDI (Social Security) taxes in the amount of $9,932.40....
-
63. 1. Use data to plot the graph and show it in your work. 2. What is Market price? 3. What is the quantity demanded at the market price? 4. What is the quantity supplied at the market price? 5. At...
-
What entities are involved in regulating the development and presentation of financial statements?
-
What is a balance sheet close, and what type of prospect might it appeal to?
-
Describe the transactional-selling tactics that emphasize low price, and give some examples.
-
What underlying characteristic creates a good cost driver?
-
The most accurate description of nominal GDP is: A. a measure of total expenditures at current prices. B. the value of goods and services at constant prices. C. a measure to compare one nation's...
-
4. The term structure of effective annual yield rates for zero coupon bonds is given as follows: Time to Maturity Spot rate 3% 4% 6% 7% 1-Year 2- Year 3- Year 4- Year
-
APC16550D UART has a clock running at18.432 MHz and its baud rate is set to 2000.Determine the HEX contents of its DLM and DLL registers. Please can you explain step by step and in detail how you get...
-
In exercise 27.1 we extended our analysis of subsidized voluntary giving from 2 to N people. In the process, we simply assumed the government would set t to cover its costs and that individuals...
-
In the text, we discussed deadweight losses that arise from wage taxes even when labor supply is perfectly inelastic. We now consider wage subsidies. A: Suppose that the current market wage is w and...
-
Below, we will investigate the profit maximizing choice in the two steps that first involve a strict focus on the cost side. A: Consider again (as in the previous exercise) a production process that...
-
Edward has the following income in 2023-24: He makes a total of 800 of Gift Aid donations during 2023-24. Compute the amount of income tax payable for the year.
-
Susan is granted a 20-year lease on a property, paying a premium of 76,000. Explain how tax relief will be given in relation to this premium if: (a) she uses the property for trading purposes, or (b)...
-
In 2023-24, Victor rents out a room in his home and receives rents of 8,150. He incurs allowable expenses of 820. What "rent-a-room" elections (if any) should he make?
Study smarter with the SolutionInn App