Question: class Airplane Let's build a class that encapsulates the data of a small airplane! Don't Panic! Watch the following video first: Do not Fear the
class Airplane
Let's build a class that encapsulates the data of a small airplane!
Don't Panic! Watch the following video first:
Do not Fear the AirplaneClick to view undefined
Your class should have the following private fields:
| data type | name | description |
| String | manufacturer | builder of the airplane |
| String | model | model number of the airplane |
| double | cost | cost of the airplane |
| double | mtow | maximum take off weight |
| double | emptyWeight | weight without fuel or passengers |
| int | stallSpeed | stall speed in knots |
| int | maximumSpeed | maximum speed in knots |
Constructors
Provide a no-argument constructor that fills the fields with the following 'generic' airplane: manufacturer = "Cessna" model = "172M" cost = 50000 mtow = 2450 emptyWeight = 1691 stallSpeed = 47 maximumSpeed = 130
Provide a constructor that fills the fields with the constructor's parameters. Suggested constructor header follows: public Airplane( String man, String mod, double c, double mtow, double ew, int ss, int ms )
General Accessors Provide an accessor for each field (yes, that's a lot of accessors). public String getManufacturer() { return manufacturer; } // example accessor
General Methods public double availablePayload( double gallonsOfFuel ) This method computes and returns the weight remaining after we load the aircraft with fuel, but no passengers. Aviation fuel, 100LL, weighs 6 pounds per gallon, so 40 gallons of fuel would weigh 240 lbs. To compute available payload, multiply the gallonsOfFuel parameter by 6 and subtract that number from mtow minus emptyWeight.
public double speedDifferential() This method returns the aircraft's maximum speed less its stall speed.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
