Question: A. Write the abstract class Aircraft as presented in the above UML. a) Write the constructor. b) Write the toString( ) method. c) Write the

 A. Write the abstract class Aircraft as presented in the above

A. Write the abstract class Aircraft as presented in the above UML. a) Write the constructor. b) Write the toString( ) method. c) Write the abstract method allowedWeight( ).

B. Do not implement the class Fighter. The code is:

public class Fighter extends Aircraft{

private double armingWeight; public Fighter(double speed, double armingWeight){

super (speed); this.armingWeight = armingWeight; }

public double allowedWeight() { return armingWeight+200; }

public String toString( ) {

return super. toString() + ", arming weight = " + armingWeight + ", and allowed weight = "+ allowedWeight(); } }

Implement the below classes and interface as presented in the following UML diagram except the class Fighter for which you will find the code provided below. For all classes implement only the getters that you will need later in your code. > Comparable + compareTo(o:E):int Aircraft speed: double + Aircraft(speed: double) +toString():String + allowedWeight(): double Fleet - aircrafts: Aircraft[] + Fleet (size: int) + addAircraft (a: Aircraft): void + aircraftAt(ind:int): Aircraft +fastestAircraft(): Aircraft Fighter -armingWeight: double +Fighter(speed:double, armingWeight:double) +toString():String Civil Aircraft -capacity: int +CivilAircraft(speed:double,capacity:int) +toString():String A. [6 pts) Write the abstract class Aircraft as presented in the above UML. a) Write the constructor. b) Write the toString() method. c) Write the abstract method allowedWeight(). B. Do not implement the class Fighter. The code is: public class Fighter extends Aircraft{ private double armingWeight; public Fighter (double speed, double armingWeight) { super (speed); this.armingWeight = armingWeight; } public double allowedWeight() { return armingWeight+200; } 11 public String toString() { return super. toString() + ", arming weight = + armingWeight + and allowed weight = "+ allowedWeight(); } "! }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!