-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathExercise.java
More file actions
28 lines (22 loc) · 879 Bytes
/
Exercise.java
File metadata and controls
28 lines (22 loc) · 879 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
public class Exercise {
public static void main(String[] args) {
TravelAgency travelAgency = new TravelAgency("Reisebuero Schmidt");
Rental rental = new Rental("Fahrzeugvermietung Mueller");
travelAgency.addPartner(rental);
Car car1 = new Car("Porsche", "911", Engine.ELECTRO, 2);
Truck truck1 = new Truck("MAN", "TGX", Engine.DIESEL, 20);
Car car2 = new Car("Opel", "Zafira Life", Engine.DIESEL, 7);
System.out.println("Anzahl Fahrzeuge: " + Vehicle.getNumberOfVehicles());
System.out.println(car1.toString());
System.out.println(truck1.toString());
System.out.println(car2.toString());
car1.accelerate(50);
truck1.transform();
car1.doATurboBoost();
truck1.transform();
rental.addVehicle(car1);
rental.addVehicle(truck1);
rental.addVehicle(car2);
System.out.println(travelAgency.toString());
}
}