Skip to content

carRentalSystem: RentalSystem.java class #111

@Shubham663

Description

@Shubham663

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions