Question
Escribe este programa en C++: Crear una clase base llamada Transporte que tenga las siguientes caractersticas: Cuenta con un constructor que recibe la marca y
Escribe este programa en C++:
Crear una clase base llamada Transporte que tenga las siguientes caractersticas:
Cuenta con un constructor que recibe la marca y el numero de pasajeros
Tiene mtodo llamado modelo que despliegue la marca del vehculo y su cantidad de pasajeros
Crear una clase llamada Moto y sea derivada de la clase base. Deber contar con lo siguiente:
Cuenta con un constructor que recibe la marca, el numero de pasajeros y el precio (los dos primero ya se pidieron en la clase Transporte).
Tiene mtodo llamado modelo que despliegue la marca del vehculo , su cantidad de pasajeros y el precio. Debe llamar a la funcin de la clase base y complementar la parte del precio.
Crear una clase llamada Camion y sea derivada de la clase base. Deber contar con lo siguiente:
Cuenta con un constructor que recibe la marca, el numero de pasajeros y las toneladas de carga (los dos primero ya se pidieron en la clase Transporte).
Tiene mtodo llamado modelo que despliegue la marca del vehculo , su cantidad de pasajeros y las toneladas. Debe llamar a la funcin de la clase base y complementar la parte de las toneladas.
En el programa principal crear un vector con 3 elementos (uno para una moto, otro para un camin y otro para un transporte).
Llamar al mtodo modelo.
Salida
Cargando los siguientes datos para el constructor:
Moto("Honda",2,35000);
Camion("Isuzu",3,1);
Transporte("BMW",4);
La salida debera verse algo similar a lo siguiente:
La marca del vehiculo es: Honda
Transporta hasta 2 pasajeros
El precio de la moto es: 35000
- - - - - - - -
La marca del vehiculo es: Isuzu
Transporta hasta 3 pasajeros
El Camion puede transportar hasta 1 toneladas
- - - - - - - -
La marca del vehiculo es: BMW
Transporta hasta 4 pasajeros
ENGLISH:
Write this program in C++:
Create a base class called Transport that has the following characteristics:
It has a constructor that 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 Moto and derive it from the base class. You must have the following:
It has a constructor that 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 complement the price part.
Create a class called Truck and derive it from the base class. You must have the following:
It has a constructor that 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 make of the vehicle, its number of passengers and the tons. You need to call the base class function and complement the tons part.
In the main program create a vector with 3 elements (one for a motorcycle, one for a truck and one for a transport).
Call the model method.
Exit
Loading the following data for the constructor:
Bike("Honda",2.35000);
Truck("Isuzu",3,1);
Transport("BMW",4);
The output should look something similar to the following:
The make of the vehicle is: Honda
Carries up to 2 passengers
The price of the motorcycle is: 35000
- - - - - - - -
The make of the vehicle is: Isuzu
Carries up to 3 passengers
The Truck can carry up to 1 tons
- - - - - - - -
The make of the vehicle is: BMW
Carries up to 4 passengers
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