(a) Develop only the class FlightPlan in this part, which is already partially developed below. (i) Add a declaration fo
Posted: Fri Jun 10, 2022 11:57 am
(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 ArrayListcontaining 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 route to a suitable empty collection.
(iii) Add a standard getter method for the route collection.
(iv) Write a public instance method greatestAltitude that 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 destination that returns 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 FlightPlan class so that it implements the appropriate interface, and then implement the compareTo method that will allow the ordering required.
(b) Develop only the class AirTrafficControl in this part, which is already partially developed below.
(i) Add a public AirTrafficControl constructor that initialises flightPlans to 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 routeMap that 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.
(i) Add a declaration for a private instance variable called route, which should be declared as a ArrayListcontaining 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 route to a suitable empty collection.
(iii) Add a standard getter method for the route collection.
(iv) Write a public instance method greatestAltitude that 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 destination that returns 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 FlightPlan class so that it implements the appropriate interface, and then implement the compareTo method that will allow the ordering required.
(b) Develop only the class AirTrafficControl in this part, which is already partially developed below.
(i) Add a public AirTrafficControl constructor that initialises flightPlans to 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 routeMap that 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.