-
Create a class
Airplane
(or evenAeroplane
). Add a constructor that initializes this plane'smake
(manufacturer)model
,speed
andaltitude
. -
Add a method
showPlane()
to display these attributes. -
Instantiate an object of this class, say a Boeing 747, and call its
showPlane()
method. -
Create a base class,
FlyingVehicle
, and have yourAirplane
extend from it.- Add a constructor.
- Refactor your classes to pull the
speed
andaltitude
properties up to the base class. - Instantiate a new
Airplane
, ensuring that both its constructor and the superclass constructor get called. - Add a method to the base class that returns
FlyingVehicle
s speed and altitude as a string. ModifyAirplane
's 'showPlane()
method to use this string in its output.
-
Create a
Helicopter
class that extendsFlyingVehicle
.- Instantiate a new Helicopter.
- Add a
static
method toHelicopter
that returns an array of flight controls, namely (1) the cyclic, (2) the collective, (3) the anti-torque pedals, and (4) the throttle. Ensure you can return this list without instantiating an object of the class. Can you call it from an instance?