Question: Implement a java program to simulate an air traffic control using a linked list (only insertions). This air traffic control must control all flights (takeoffs
Implement a java program to simulate an air traffic control using a linked list (only insertions). This air traffic control must control all flights (takeoffs and landings) on a specific airway.
Takeoff: Insert a new node (flight)
Landing: Remove the specific node (next class exercise).
*note: An airway or air route is a defined corridor that connects one specified location to another at a specified altitude, along which an aircraft that meets the requirements of the airway may be flown. (source: wikipedia)
The program should ask for the following information:
- Flight number (e.g. NAX7091)
- Origin (e.g. Austin, Texas)
- Destination (e.g. Los Angeles, California)
- Airline name (e.g. American Airlines)
- Departure (e.g. Mon 02:00PM)
- Arrival (e.g. Mon 05:00PM)
You need to modify the Aircraft.java file to include the variables. Remember that the Aircraft class must have a next variable.
Using a for loop, insert at least 5 flights.
Implement the printAirTraffic method to print the airway traffic (linked list).
GIVEN:
Aircraft.java
class Aircraft{ String flightNumber; Aircraft next; }
Main.Java
class Main{ public static void main (String[] arg){ Aircraft airway = null; //This is the head (the airway) airway = new Aircraft(); // Creates an empty airway Aircraft flight = airway;
//your code goes here
printAirTraffic(airway); } public static void printAirTraffic(Aircraft airway){ //Implement this method } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
