Note: Please, You need BoatPlane.cpp. In one file. Earlier Answer is wrong.
Please Do not do if you are not sure. Before you post please check the question and answer one more time. Because I had bad experience earlier. thank you.
Maximum number of files: 2
Given two classes: Plane and Boat that share common methods (add,remove) of adding and removing passengers, and the following characteristics that are distinct to each object:
each has their own method to steer; Bank, Tack
each has their own medium used for travel: Air, Sea
each with their own method to accelerate: jetThrust, setSails
each with their own method to brake: wingFlap, furlSails
each has their own sense of direction:
Plane: Nose, Tail, Left, Right
Boat: Bow, Stern, Port, Starboard
Create an abstract class Vehicle that has the methods common to all classes.
Create a derived class Boat that inherits from Vehicle and has the appropriate fields and functions.
Create a derived class BoatPlane that inherits from Boat that adds the appropriate fields and overloads the appropriate functions. A BoatPlane should be able to distinguish whether it is traveling as a Plane or a Boat.
The test of your BoatPlane class should invoke the functions to accelerate, steer, brake, and stop.
Each function should simply print out a label of which method is being used: for example when you have a Boat object, accelerate() should print "setSails". When you have a PlaneBoat object accelerate() should print "jetThrust".