Question: (Inheritance) Hand-write two Java classes, Car and Truck. They are both subclasses of Vehicle. a. A car has an additional instance variable, number of doors.
(Inheritance) Hand-write two Java classes, Car and Truck. They are both subclasses of Vehicle.
a. A car has an additional instance variable, number of doors.
b. A truck has an additional instance variable, number of axles
c. Write a constructor that requires input for the instance variables of each class (including registration number and owner name).
d. Write getters and setters for all instance variables for both classes.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
