Skip to content

Commit 6542287

Browse files
committed
fix solution
1 parent 3010706 commit 6542287

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

Exercise.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ public static void main(String[] args) {
2121
rental.addVehicle(truck1);
2222
rental.addVehicle(car2);
2323

24+
rental.transformAllTrucks();
25+
2426
System.out.println(rental.toString());
2527
}
2628
}

Rental.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ public void transformAllTrucks() {
3232
for (Vehicle c : vehicles) {
3333
if (c instanceof Truck) {
3434
Truck t = (Truck) c;
35-
t.transform();
35+
if (!t.isTransformed())
36+
t.transform();
3637
}
3738
}
3839
}

0 commit comments

Comments
 (0)