-
Notifications
You must be signed in to change notification settings - Fork 0
/
ElectricCar.java
84 lines (72 loc) · 2.12 KB
/
ElectricCar.java
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/**
* @author Parth Patel #500893723
* ElectricCar class inherits everything from Car
*
*/
public class ElectricCar extends Car {
private int rechargeTime;
private String batteryType;
/**
* @param mfr is the manufacturer name (Inherited from the Vehicle class)
* @param color is the Color of car (Inherited from the Vehicle class)
* @param power is the power source of the car (Inherited from the Vehicle class)
* @param numWheels is the number of wheels (Inherited from the Vehicle class)
* @param model is the model type
* @param maxRange
* @param safetyRating
* @param AWD
* @param price
* @param rechargeTime
* @param batteryType
*/
public ElectricCar(String mfr, String color, int power, int numWheels, int model,
int maxRange, double safetyRating, boolean AWD, double price, int rechargeTime, String batteryType)
{
super(mfr, color, power, numWheels,model, maxRange, safetyRating, AWD, price);
this.rechargeTime = rechargeTime;
this.batteryType = batteryType;
}
/**
* @return rechargeTime
* this method returns the recharge time for the car
*/
public int getRechargeTime()
{
return rechargeTime;
}
/**
* @param rechargeTime1
* this method sets the recharge time for the variable rechargeTime to the parameter passed
*/
public void setRechargeTime(int rechargeTime1)
{
rechargeTime = rechargeTime1;
}
/**
* @return batteryType
* returns a string containing the type of the battery the car has
*/
public String getBatteryType()
{
return batteryType;
}
/**
*
* @param batteryType1
* sets the variable batteryType to the stirng parameter passed to the method
*/
public void setBatteryType(String batteryType1)
{
batteryType = batteryType1;
}
/**
* @return String
* this method overrides the method display() in the Car class and adds the extra attributes to the string
* that an Electric Car would have
*/
@Override
public String display()
{
return super.display() + " " + "BAT: " + getBatteryType() + " "+ "RCH: "+ getRechargeTime();
}
}