Demonstrate the use of classes and objects Inheritance and polymorphism. Write a program for a used car dealer to keep track of inventory. The dealer buys and sells three kinds of vehiclesCarCar: cars, boats, and busses. Each vehicle in inventory should have an instance of an object instantiated for it. Each object should have at least one constructor and should use get and set methods to set and read the object properties. The vehicle class should contain all the objects and methods that all vehicles share such as the properties make, model, purchase price (what the dealer paid to get this vehicle on the lot), asking price (the price the dealer wants for this vehicle), etc., and the methods get, set, printableString, and others. (Suggested other methods are calculating profit on a sale or calculating salespersons commission on the sale.) The Car class should have the properties that are unique to cars (number of passengers, number of doors, etc). The Boat class should have the properties that are unique to boats (weight, #of passengers, motor horse power, etc.). The Bus class should have the properties that are unique to busses (length, number of passengers, etc). Make the object instances keep track of how many of each type of vehicle are on the lot. When selling a vehicle, you will remove the object and decrement the count for that vehicle class. When adding a vehicle to inventory, an object needs to be instantiated and the count for that vehicle type increased. (Hint: Use a static counter.) Demonstrate the use of inheritance (Hint: Vehicle is the super class). Also, demonstrate polymorphism in this project. Allow the user to add inventory (create new objects), sell inventory (remove objects), and display current inventory (display each objects properties one at a time). IMPORTANT: None of these classes, vehicle, car, boat, or bus, should have direct input or output. This means that a common UserInterface class should handle the IO, not the car class. Or, said another way, the car class should not ask the user for the value of a property, nor shall it print output directly to the screen. Listed below is the UML diagram for the minimum level project for this assignment.

Vehicle class
- vehCount : int Static
- make : string
- model : string
- purchasePrice : int
- askingPrice : int
+ Vehicle (make : string, model : string, purchasePrice : int, askingPrice : int)
+ getMake() : string
+ setMake( make : string)
(add get and set for model, purchasePrice, and askingPrice)
+ deal( custOffer : int) : Boolean
+ remove()
+ calculateCommission(custOffer : int) : int
Car class extends Vehicle
- carCount : int Static
- passCount : int
- doorCount : int
- mpg : double
+ Car(passCount : int, doorCount : int, mpg : double, make : string, model : string, purchasePrice : int, askingPrice : int)
(add get and set for passCount, doorCount and mpg)
+ remove()
+ printableString(): string
Bus class extends Vehicle
- busCount : int Static
- length : int
- passCount : int
- diesel : Boolean
+ Bus(length : int, passCount : int, diesel : Boolean, make : string, model : string, purchasePrice : int, askingPrice : int)
(add get and set methods for length, passCount, and diesel)
+ remove()
+ printableString(): string
Boat class extends Vehicle
- boatCount : int Static
- weight : int
- passCount : int
- totalHP : int
+ Boat(weight : int, passCount : int, make : string, model : string, purchasePrice : int, askingPrice : int)
(add get and set methods for totalHP, weight, and pasCount)
+ remove()
+ printableString(): string
UserInterface

+ displayCurVehicle() : string
+ moveToNextVehicle()
+ moveToPrevVehicle()
+ addCar( )
+ addBus()
+ addBoat()
+ removeCurVehicle()
+ displayNumberOfVehicles()
+ acceptCustOfferOnCurrVehicle(custOffer : int) : Boolean
+ salesCommission(custOffer:int) : int

Next Phase

Project #4: Demonstrate GUIs and string manipulation. Modify the program you wrote in Project #3 removing the UserInterface class, and replacing it with a GUI interface. Do not use the built in NetBeans GUI tool. Instead, you should code the GUI interfaces yourself. Your GUI should allow the user to use your program in a user friendly way. The program should never crash no matter what the user does.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.