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

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Create a c ++ program using the concepts of Polymorphism and Inheritance.

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 vector with 3 elements (one for a motorcycle, another for a truck and another for a transport).

Call the model method.

The image shows the output data that you should have

Note: Create the program in c ++

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
Transcribed Image Text: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
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY