Close
Close

SOLVE IT

   gopiaryan@7

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 Audi and Ford of Car, each having a data member to store the model type. Next, make two subclasses Bajaj and TVS, each having a data member to store the make-type.
Now, store and print the information of an Audi and a Ford car (i.e. model type, ownership cost, warranty, seating capacity, fuel type, mileage and price.) Do the same for a Bajaj and a TVS bike.


Answers

  •    Dimpy

    #include 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; };





  •    OsbornTyler7

    That's a very interesting idea. I would like to know more about private license plates in the UK that do not break the rules. I've seen similar services on number plate maker. Can they be trusted? This is where the question arises? Who can check it or make any claims if it is an "individual creation"? Because the rules of the road are very important to any driver. Thank you in advance for any advice.



Ask Yours
Post Yours
Write your answer