Computer Science, asked by jaiminglsbca20, 5 hours ago

Create a class named Vehicle with two data members 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). and 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).

Answers

Answered by amproc
0

Answer:

The programming language wasn't mentioned, so I wrote a class in C++ related to your question:

class Vehicle {

     double mileage;

     double price;

     class Car {

         double OwnershipCost;

         int warranty;

         int seatingCapacity;

         enum class FuelType {

             petrol,

             diesel,

         }

     }

     class Bike {

         int Cylinders;

         int Gears;

         enum class CoolingType {

              alloys,

              spokes,

         }

         double FuelTankSize;

     }

}

Explanation:

-

Similar questions