☑Kizspy.me
3 of 4
Paper No: 1
NEW WORLD!
60
Sunny-hcm-50-100
Question 2:
(3 marks)
Write a class named Car and a class named ElectricCar extended from Car (i.e. Car is a superclass and
Electric Car is a subclass) with the following information:
Zoom
Car
- brand: String
- model: String
-year: int
+ Car()
+Car(brand: String, model: String, year:
int)
Where:
• Car(brand: String, model: String, year: int) - a
parameterized constructor that sets values
for brand, model, and year.

getCarAge(currentYear: int): int - return the
car's age = the currentYear - the year. If the
car's age <0, return 0
+ 100%
Close