Preparing your design workspace

Loading the problem and your saved attempt…

Design and Implement Car Rental Reservations

Model reservation, pickup and return while protecting each car from conflicting bookings and simultaneous rentals.

For this exercise, assume one rental branch maintains identifiable cars. A customer reserves a specific car for a half-open interval [start,end), may cancel before pickup, picks up during that interval, and returns it at the same branch.

Two live reservations for the same car may not overlap; touching intervals are allowed. A cancelled or completed reservation no longer blocks future availability. A car with an active rental cannot be picked up again, even after its planned return time. Use an injected clock for actual transition times.

Design the objects, contracts and collaborations for this journey, including invalid requests and simultaneous reservations. Pricing, payments, transfers, damage handling and automatic car substitution are outside scope.

Design the model, then implement the bounded in-memory reservation operation and tests for its interval rules. Repeated cancellation of a cancelled reservation and return of a returned rental are idempotent successes.