Question: Write 3 Java classes called Car, OffroadCar and HybridCar.Demonstrate the concept of inheritance by making the Car class yoursuperclass. Give it the following attributes: int

Write 3 Java classes called Car, OffroadCar and HybridCar.Demonstrate the concept of inheritance by making the Car class yoursuperclass. Give it the following attributes:

int num_doors; // number of doors the car has

int hp; // the horse power of the car

boolean manual; // true if manual transmission, false ifautomatic

____________

OffroadCClass

should be derived from the Car class and have the additionalattribute:

int wheel_diameter; // diameter of wheel in mm.

_____________________

HyCar

should be derived from the Car class and have the additionalattribute:

int batteries; // number of batteries in the car

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!