-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
25 lines (19 loc) · 757 Bytes
/
Main.java
File metadata and controls
25 lines (19 loc) · 757 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
public class Main {
public static void main(String[] args) {
RentalService service = new RentalService();
// Add vehicles
service.addVehicle(new Car("C101", "Honda City", 1200));
service.addVehicle(new Bike("B201", "Royal Enfield", 500));
service.addVehicle(new Truck("T301", "Tata LPT", 2000));
service.listAvailableVehicles();
// Rent a car
Vehicle rentedCar = service.rentVehicle("C101");
if (rentedCar != null) {
System.out.println("Total cost for 3 days: ₹" + rentedCar.calculateRentalCost(3));
}
service.listAvailableVehicles();
// Return car
service.returnVehicle("C101");
service.listAvailableVehicles();
}
}