Question: Write a program in C++ . Using vehicle as a parent (base) class, cars and motorcycles as offspring (derived) classes to maintain and display a
Write a program in C++ . Using vehicle as a parent (base) class, cars and motorcycles as offspring (derived) classes to maintain and display a list of vehicles , should calculate the sales price and monthly payments for a designated vehicle.
The class should have data elements for the following info: Make,Model,color,mileage,fuelconsumption and list price. The following will be derived classes from the vehicle: Automobile,motorcycle. Program will need to have functions to : add miles to the mileage from test drives or employee use and another separate function to subtract/decrease the mileage. Program will also need a List class. The List class will use a dynamic array to store Vehicle objects. Program will have one list for Automobiles and one for Motorcycles. The List class will use a dynamic array to store Vehicle objects. Program will have one list for Automobiles and one for Motorcycles. Program will NEVER have an object of class Vehicle. As each vehicle is entered an object of the appropriate type must be created and added to the correct array.Double the size each time you increase capacity. Program must perform the following activities: create a list, add items, search for a vehicle, calculate the price and payments for a vehicle, remove a vehicle, and display the inventory. Some of these should be member functions of the List class, and which will be functions in your program. The user should be able to search for any attribute (data member) of the Vehicle, Automobile, or Motorcycle classes. To add an item you should prompt the user to enter the required information.
The display should show: Menu of choices (display all vehicles in the inventory, adjust mileage for a vehicle, search for a vehicle, add a vehicle, calculate purchase price for a vehicle, and exit. The calculate price option should remove the vehicle if it was sold. The search should display the information for each vehicle matching the criteria.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
