Question
This lab will use the concept of a doubly-linked list to simulate part of an air traffic control system. The program will manage the arrival
This lab will use the concept of a doubly-linked list to simulate part of an air traffic control system. The program will manage the arrival and departure of flights into and out of your airspace.
The job of air traffic controller involves taking responsibility for all of the aircraft in a specific area of the airspace. The airspace for this problem will be a piece of the traffic corridor between the cities of Buffalo and Boston, Ma. Other controllers will have responsibility for the area to the east, west, north and south of you but your area will be under your exclusive control.
The program will accept certain commands from you and will display certain information to you in response. The commands and their responses will be as follows:
Command: Entering This command will signal that an aircraft has entered your airspace. You will be able to specify
The ID int of an aircraft
The altitude int thousands of feet
The speed int miles per hour
The name String (ex: U566)
Response: one aircraft will be added to your problem
Command: Leaving you will give the aircraft name
Response: it will be removed from your problem
Command: Show you will give the aircraft name
Response: all information for that aircraft will be displayed
Command: Display
Response: all aircraft in your problem will be displayed in a list
Implementation:
You will create a doubly-linked list in Java. You will implement an aircraft class which will take the place of the node class which was discussed. Objects of this aircraft class will be linked together in a list, as they are entered into the problem. When the Display command is entered, all the aircraft currently on the list will be displayed to the user.
Remember:
Use object reference variables for links between nodes
Implement two classes
linked list class which will be used by main to manipulate objects of the aircraft class
an aircraft class whose objects will contain aircraft information.
The main program should be the place where all of the conversation with the user takes place. This means that;
The linked list object will be able to return a single aircraft object in response to the Show command and will return an array of aircraft objects in response to the Display command.
The aircraft class should have a method that returns a String, suitable for displaying all of its information (used in the Show command) and another method that returns its name (used in the Display command). This will prevent the main program from having to know the details of the data inside the aircraft class.
There will be NO keyboard or display accessing in the aircraft class nor in the linked list class
Outline of classes
Main
Create linked list object
Loop while cmd not quit
Enter
Get AC info from user
Add an AC to list
Leave
Get AC name from user
Delete AC from list
Display
Get AC count from list
Loop from 1 to count
Show each AC
Display all existing AC in order of altitude
Show
Get AC name from user
Search list for name
Show AC found
When quitting, tell list to delete all remaining AC (if any).
Linked List
Get AC count
Add an AC
Delete an AC
Show AC by number
Search for AC by name and return the number
Delete all AC
Aircraft
Get name
Set name
Set type
Set altitude
Set speed
Testing:
In order to save a lot of typing, you may use single character commands (Ex: e for entering, l for leaving etc.).
You should be able to
entering the first aircraft
entering the second aircraft
entering the third aircraft
display all three, in altitude-order
show the first
show the third
leaving the second
show the second (present an appropriate error message)
display both remaining
leaving the third
display the remaining one
leaving the first
display the empty list
Step by Step Solution
There are 3 Steps involved in it
Step: 1
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