Question: C. Implement the class CivilAircraft. It has one private data, capacity, that indicates the maximum number of passengers that can be transported. a) Write the


C. Implement the class CivilAircraft. It has one private data, capacity, that indicates the maximum number of passengers that can be transported.
a) Write the constructor.
b) Implement the allowedWeight method. The average weight per passenger including baggage is 120kg. The allowed weight for a civil aircraft is the sum of the average weights for all passengers and 900kgs reserved for staff members.
c) Implement the compareTo method of the Comparable Interface. Two aircrafts are comparable by their allowed weight.
d) Write the toString() method returns a description of the form: Speed =, capacity= , and allowed weight =
> Comparable + compareTo(o:E):int 1 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 CivilAircraft -capacity: int +CivilAircraft(speed:double,capacity:int) +toString():String It has one private data, capacity, that indicates the maximum number of passengers that can be transported. a) Write the constructor. b) Implement the allowedWeight method. The average weight per passenger including baggage is 120kg. The allowed weight for a civil aircraft is the sum of the average weights for all passengers and 900kgs reserved for staff members. c) Implement the compareTo method of the Comparable Interface. Two aircrafts are comparable by their allowed weight. d) Write the toString() method returns a description of the form: Speed =..., capacity= and allowed weight =
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
