PRO192_-_PE01_-_SU_2025_4004.webp
white_cloud1

PRO192_-_PE01_-_SU_2025_4004.webp

☑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
Chưa có bình luận nào.

Thông tin

Category
PRO192
Thêm bởi
white_cloud1
Ngày thêm
Lượt xem
3,863
Lượt bình luận
0
Rating
0.00 star(s) 0 đánh giá

Share this media

Back
Bên trên Bottom