Grossmont College Java Questions

User Generated

qnavnnynmnjrr278

Programming

Grossmont College

Unformatted Attachment Preview

Background In a busy airport, planes must fly a holding pattern before getting clearance to land. Planes can land based on the time they requested landing clearance, or on other factors like how much fuel they have left. This Assignment Create a Java test driver app that simulates an airport landing queue. • Add at least 4 planes to an instance of Java's PriorityQueue class. Provide a name and fuel percentage level for each plane you add. Use loop(s) to simulate the landing of each plane in your priority queue. The plane with the lowest percentage of remaining fuel should land next, The other planes will stay in the landing queue. • Watch this short video (2:44) that demonstrates what your output should look like. Use These Classes • class Plane will: • hold the name of the flight (type String) and the percentage of fuel remaining (type int) as private class variables, • provide public mutator (setter) and accessor (getter) methods for its private class variables, • provide a public static Comparator for use by the priority queue (study the sample Comparator code in PQDemo2.zip and watch the Week 7 micro-lecture video on Comparators (21:09), e), • provide public method void setRandFuelPct() that randomly decreases a plane's fuel percentage level, • provide a public print() method to nicely display each plane's name and remaining fuel percentage. class AirportLandingPQ will: • provide a private class variable of type PriorityQueue that holds Plane instances, • provide a public constructor method that initializes the priority queue and other class variables as needed, • provide these public methods that manage the priority queue: void addPlane(Plane p), Plane removePlane(), int getPlaneCount(). class Test Driver will add at least 4 planes to the priority queue, then loop to land one plane at a time. • Use the AirportLandingPQ method void addPlane(Plane P) to add planes. • Use one or more loops to land all planes you added to the priority queue. • Land the plane with the lowest fuel level first. • Each time through your loop, display the name and fuel level of the plane landing and all other planes in the priority queue • Use public method void setRandFuelPct() to decrease the fuel level of each plane that hasn't landed. What to Submit Submit a .zip file that contains 3 files: 1. AirportLandingPQ.java 2. Plane.java 3. TestDriver.java
Purchase answer to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Explanation & Answer

View attached ex...


Anonymous
Goes above and beyond expectations!

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4

Related Tags