-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathElectricCar.java
More file actions
executable file
·32 lines (30 loc) · 993 Bytes
/
ElectricCar.java
File metadata and controls
executable file
·32 lines (30 loc) · 993 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
//Name: Marco Bozic
//Student Number: 500896651
//ElectricCar class extends Car class
public class ElectricCar extends Car
{
int rechargeTime;//minutes
String batteryType;
public ElectricCar(String manuf, String color, String model, Vehicle.PowerSource power,
double safety, int range, boolean awd, double price, int rch)
{
super(manuf, color, model, Vehicle.PowerSource.ELECTRIC_MOTOR, safety, range, awd, price);
rechargeTime = rch;
batteryType = "Lithium";
}
//method that sets recharge time based on parameter value
public void setRechargeTime(int time)
{
rechargeTime = time;
}
//method that sets battery type based on parameter value
public void batteryType(String type)
{
batteryType = type;
}
//method that is used to display information about an electric car as a String
public String display()
{
return super.display() + " " + "EL, BAT: " + batteryType + " RCH: " + rechargeTime;
}
}