-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCompact.java
More file actions
38 lines (29 loc) · 938 Bytes
/
Copy pathCompact.java
File metadata and controls
38 lines (29 loc) · 938 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
33
34
35
36
37
38
package carbookingsystem1;
public class Compact extends Car {
private boolean ThereIsSunroof;
public Compact(boolean sunroof, int carID, String car_model, SpecialFeature[] f, boolean avalability, String color) {
super(carID, car_model, f, avalability, color);
setThereIsSunroof(sunroof);
}
public Compact() {
this(false, 0, "", null, false, "");
}
public boolean isThereIsSunroof() {
return ThereIsSunroof;
}
public void setThereIsSunroof(boolean ThereIsSunroof) {
this.ThereIsSunroof = ThereIsSunroof;
}
@Override
public String toString() {
return String.format("%s Sunroof: %s%n", super.toString(), isThereIsSunroof());
}
@Override
public int calculateRentalPrice() {
if (isThereIsSunroof()) {
return 300;
} else {
return 250;
}
}
}