Click here to Skip to main content
15,615,469 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
We want to store the information of different vehicles. Create a class named Vehicle with
two data member named mileage and price. Create its two subclasses *Car with data members
to store ownership cost, warranty (by years), seating capacity and fuel type (diesel or
petrol).*Bike with data members to store the number of cylinders, number of gears, cooling
type (air, liquid or oil), wheel type (alloys or spokes) and fuel tank size (in inches).Make another
two subclasses Toyota and Honda of Car, each having a data member to store the model type.
Next, make two subclasses Yamaha and Suzuki, each having a data member to store the make-
type. Now, store and print the information of a Toyota and a Honda car (i.e. model type,
ownership cost, warranty, seating capacity, fuel type, mileage and price.) Do the same for a
Yamaha and a Suzuki bike.

What I have tried:

Code of given problem is not easy for me. I tried a lot to understand the question but couldn't. Please anyone who can help me.
Updated 14-Jun-21 1:30am

You need to visit some Learn C++ tutorial and learn basic programming.

tip 1: use the std:string class
tip 2: write functions for every task
tip 3: write tests for all functions and check for correct results
Share this answer
class Vehicle
    int mileage;
    int price;
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900