☑Kizspy.me
ElectricCar is a subclass) with the following information:
- brand: String
- model: String
-year: int
+ Car()
Car
+ Car(brand: String, model: String, year:
int)
+getCarAge(currentYear: int): int
+ toString(): String
ElectricCar
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 current Year - the year. If the
car's age <0, return 0

toString(): String - return a string format that
contains all the information of the Car: brand,
model, year
Where:
Zoom
- batteryCapacity: int
+ ElectricCar()
+ ElectricCar(brand: String, model:
String, year: int, batteryCapacity: int)
+getEstimatedRange(speed: int): int
+toString(): String
ElectricCar(brand: String, model: String, year:
int, batteryCapacity: int) a parameterized
constructor that sets values for brand, model,
year, and batteryCapacity (the battery capacity
in kWh).
getEstimated Range(speed: int): int - return
the estimated driving range(ER) based on the
battery capacity, with ER = batteryCapacity *K,
K is calculated by the following formula:
•
At speed 60 (km/h) and the car can travel
5 km per kWh, K=5
+ 100%
Close