Answer to Question #187559 in C++ for Garima

Question #187559

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).


1
Expert's answer
2021-04-30T12:00:27-0400
#include <iostream>
using namespace std;


class Vehicle
{
private:
    double mileage;
    double price;
};


class Car: public Vehicle
{
private:
    double ownershipCost;
    int warranty;
    int seatingCapacity;
    string fuelType;


};


class Bike: public Vehicle
{
private:
    int numberOfCylinders;
    int numberOfGears;
    string coolingType;
};

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS