Question: Create class Car with below attributes: make model passengerCapacity onRoadPrice - Create another class CarDemo which has main method. Create another method getBestCar in

Create class Car with below attributes: make model passengerCapacity onRoadPrice - Create another class CarDemo which has main method. Create another method getBestCar in this class which will take four car objects and additional parameter as compareType. Value of this parameter can be 'c' or 'p', where 'c' stands for capacity of passengers and 'p' stands for on road price. This method will return make and model name for highest value of 'c' or 'p' (with - character in between. E.g for make - Hyundai and model - santro, method should return "Hyundai-santro"). Create four objects of Car class in main method and drive it through getBestCar method. Use inheritance to code this program.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
