File tree Expand file tree Collapse file tree
carRentalSystem/src/main/java/com/lld/carRentalSystem Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1616public class Main {
1717
1818 public static void main (String args []) {
19-
2019 List <User > users = addUsers ();
2120 List <Vehicle > vehicles = addVehicles ();
2221 List <Store > stores = addStores (vehicles );
2322
2423 VehicleRentalSystem rentalSystem = new VehicleRentalSystem (stores , users );
2524
26- //0. User comes
2725 User user = users .get (0 );
26+ Location location = new Location (123 , "city" , "state" , "country" );
2827
29- //1. user search store based on location
30- Location location = new Location (403012 , "Bangalore" , "Karnataka" , "India" );
3128 Store store = rentalSystem .getStore (location );
32-
33- //2. get All vehicles you are interested in (based upon different filters)
3429 List <Vehicle > storeVehicles = store .getVehicles (VehicleType .CAR );
3530
36- //3.reserving the particular vehicle
3731 Reservation reservation = store .createReservation (storeVehicles .get (0 ), users .get (0 ));
3832
39- //4. generate the bill
4033 Bill bill = new Bill ();
4134 bill .setReservation (reservation );
4235
43- //5. make payment
4436 Payment payment = new Payment ();
4537 payment .payBill (bill );
4638
47- //6. trip completed, submit the vehicle and close the reservation
4839 store .completeReservation (reservation .getResId ());
49-
5040 }
5141
52-
53-
5442 public static List <Vehicle > addVehicles (){
5543
5644 List <Vehicle > vehicles = new ArrayList <>();
You can’t perform that action at this time.
0 commit comments