awesome-low-level-design icon indicating copy to clipboard operation
awesome-low-level-design copied to clipboard

carRentalSystem: RentalSystem.java class

Open Shubham663 opened this issue 6 months ago • 0 comments

In the makeReservation method we set the Car's available field to false. After that when finding the available cars we have placed a check on this available field of the Car object to see if it is available. This leads to incorrect behavior as then cars would only be booked once. Consider the following example: suppose there is a booking for a car from 20/04/2025 to 24/04/2025, therefore during the makeReservation call, this car's available field is set to false. Now if i want to make another reservation, say from 25/04/2025 to 30/04/2025, the condition "car.isAvailable()" will prevent me from making the reservation, while it is a valid reservation.

Shubham663 avatar Apr 25 '25 10:04 Shubham663