-
Notifications
You must be signed in to change notification settings - Fork 0
/
Truck.java
59 lines (50 loc) · 1.48 KB
/
Truck.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
public class Truck extends Vehicles{
private boolean airConditionON;
private int power;
private int numberOfSeats;
public void setAirConditionON_Off(boolean value)
{
airConditionON=value;
}
/**
* @param numberOfSeats the numberOfSeats to set
*/
public void setNumberOfSeats(int numberOfSeats) {
this.numberOfSeats = numberOfSeats;
}
@Override
public double costFor100km(PetroleumType type) {
if(airConditionON)
fuelConsumption=fuelConsumption+(fuelConsumption*0.2);
return (100/fuelConsumption)*type.getDieselPrice();
}
/**
* @param airConditionON the airConditionON to set
*/
public void setAirConditionON(boolean airConditionON) {
this.airConditionON = airConditionON;
}
/**
* @param power the power to set
*/
public void setPower(int power) {
this.power = power;
}
@Override
public String toString() {
return super.toString()+": Truck [airConditionON=" + airConditionON + ", power=" + power + ", numberOfSeats=" + numberOfSeats
+ "]";
}
@Override
public void setAirConditionOn() {
// TODO Auto-generated method stub
}
@Override
public void setAirConditionff() {
// TODO Auto-generated method stub
}
@Override
public int compareTo(Vehicles obj) {
return this.getOwner().getName().compareTo(obj.getOwner().getName());
}
}