You are writing a simple application to help Ernie’s Car Consignment, to keep track of his inventory. Ernie sells cars and truck for their owner. The following diagrams describe the classes you will need for this project.
Part I (50 points)
You will first need to code Person, Vehicle, Car and Truck class. As you can see, Vehicle is the base class from which the Truck and Auto classes inherit. The two derived classes describe two ‘types’ of Vehicle. Note that the ‘owner’ field is of class ‘Person’ described by the diagram:
The Vehicle class provides a constructor, which initializes its instance data variables, in addition to accessor methods for each instance variable. Each of the extending classes provide additional data members specific to the type of Vehicle, plus additional methods needed to maintain the object. The ‘desiredPrice’ is the price that the owner wants for the Vehicle.
Each of these classes provides a specific ‘regCost’ method to compute the price the vehicle. Ernie’s pricing works as follows: each vehicle cost computation begins with the amount the owner wants for the vehicle. Ernie then adds 33% if it is a Car and 25% if it is a Truck. The ‘totalCost’ for any vehicle is it’s ‘regCost’ plus tax, which is 8.25%.
PrintSticker functions are provided to printout all vehicle details, including cost before and after tax.
Part II (50 points)
You are to write a test that will allow the user to store vehicle information. Your program should allow the user to do any of the following, until the user decides to exit.
enter a new Car
enter a new Truck
print out all Cars currently stored
print out all Trucks currently stored
accept a price as input, and output all Cars which are available under that price (before tax)
accept a price as input, and output all Trucks which are available under that price (before tax)
accept a price as input, and output all vehicles which are available for that price (before tax)
accept a car manufacturer, and output all Vehicles which are made by that manufacturer
Each object created must be stored for the remainder of the program, so you will need to have a list.