Output Loading the following data for the constructor: motorcycle("Honda", 2,35000); truck("Isuzu", 3,1) transport("BMW" , 4); The output should look something like the following: The make of the vehicle is: Honda Carries up to 2 passengers The price of the bike is: 35000 The brand of the vehicle is: Isuzu Carries up to 3 passengers The truck can transport up to 1 ton The make of the vehicle is: BMW Carries up to 4 passengers
Create a c ++
Instructions
Create a base class called Transport that has the following characteristics:
It has a builder who receives the brand and the number of passengers
It has a method called model that displays the brand of the vehicle and its number of passengers
Create a class called Motorcycle and derive it from the base class. You must have the following:
- It has a builder who receives the brand, the number of passengers and the price (the first two were already requested in the Transport class).
- It has a method called model that displays the brand of the vehicle, its number of passengers and the price. You need to call the base class function and supplement the price part.
Create a class called Truck and derive it from the base class. You must have the following:
- It has a builder who receives the brand, the number of passengers and the tons of cargo (the first two were already requested in the Transport class).
- It has a method called model that displays the brand of the vehicle, its number of passengers and the tons. You need to call the base class function and supplement the tons part.
In the main program create a
Call the model method.
The image shows the output data that you should have
Note: Create the program in c ++
Step by step
Solved in 2 steps with 1 images