Question
Note: Please, I need BoatPlane.cpp. In one file. Earlier Answer is wrong. Please help me out. Use C++ programming language. Please do it from scratch,
Note: Please, I need BoatPlane.cpp. In one file. Earlier Answer is wrong.
Please help me out. Use C++ programming language. Please do it from scratch, I also need output too. The earlier answer has not been valid. So please make sure to explain your codes also.
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"
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started