Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Air Traffic Control oversees all the flight plans of the flights taking off from airports in their jurisdiction. A flight plan includes the call sign

Air Traffic Control oversees all the flight plans of the flights taking off from airports in their jurisdiction. A flight plan includes the call sign of the airplane and a list of all of the points on a route, including the departure and the destination airports, in the order in which they should be encountered (these points are called waypoints). A Waypoint has a name, a coordinate and an altitude. The class Waypoint (click to view this file) has already been developed.

Please note that the answer box below contains two classes to complete. You can only use import statements at the top of the answer box.

The answer box below includes some methods of the class FlightPlanthat you should not alter, as well as the declarations for the fields of the AirTrafficControlclass.

(a) Develop only the class FlightPlan in this part, which is already partially developed below.

(i) Add a declaration for a private instance variable called route, which should be declared as a ArrayList containing elements of type Waypoint.

(ii) Add a public constructor for FlightPlan that takes one string parameter representing the call sign of the airplane and initialises the related variable accordingly. The constructor should also initialise routeto a suitable empty collection.

(iii) Add a standard getter method for the routecollection.

(iv) Write a public instance method greatestAltitudethat has no parameters and returns the altitude of the highest waypoint on the route of this flight plan. You can assume that there are at least three waypoints on the route.

(v) Write a public instance method destinationthatreturns the name of the final waypoint on the route of this flight plan.


(vi) The air traffic controllers want to be able to sort flight plans by their call signs in ascending order. Modify the FlightPlanclass so that it implements the appropriate interface, and then implement the compareTo method that will allow the ordering required.

(b) Develop only the class AirTrafficControlin this part, which is already partially developed below.

(i) Add a public AirTrafficControl constructor that initialises flight plansto a suitable collection type (initially empty).

(ii) Add a public method addFlightPlan that adds the parameter, of type FlightPlan to flightPlans. Nothing is returned from the method.

(iii) Add a public instance method routeMapthat returns a HashMap in which the keys are the call signs of the flight plans and each value is an ArrayList of the names of the waypoints on the corresponding route, in the order in which they should be encountered.

This question is copyright The Open University UK.5db2d079877146bf91f72ab11f65d48c

For example:

Test Result
//Checks constructor and getter (a)(ii) and (iii) FlightPlan f = new FlightPlan("SAS9003"); System.out.println(f.getCallSign()); System.out.println(f.getRoute()); SAS9003 []

Step by Step Solution

There are 3 Steps involved in it

Step: 1

Heres the breakdown of how to solve this programming problem along with the code for both the FlightPlan and AirTrafficControl classes Part a FlightPl... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Smith and Roberson Business Law

Authors: Richard A. Mann, Barry S. Roberts

15th Edition

1285141903, 1285141903, 9781285141909, 978-0538473637

More Books

Students also viewed these Programming questions

Question

What topics of interest can you use CPM Theory to investigate?

Answered: 1 week ago