Car Rental System – Low Level Design Interview Practice
Practise the Car Rental System low level design problem the way an LLD round actually runs. You are asked for requirements first, then a class model, and then to extend the design when a new requirement lands part way through – the follow-up that separates a design that was memorised from one that was understood.
The round checks the things interviewers grade: whether your classes carry single responsibilities, whether you reached for a design pattern or reinvented one, whether the design absorbs a new requirement without rewriting what exists, and whether you can explain a trade-off out loud. Feedback covers class modelling, SOLID principles, use of patterns, extensibility and communication.
What this question is really testing
Inventory across locations, and pricing that varies on several axes at once without becoming a conditional thicket.
Requirements to establish first
- Search available vehicles by location, date range and vehicle class.
- Reserve a vehicle for a date range from a pickup branch.
- Price by class, duration and season, with add-ons such as insurance or a child seat.
- Record pickup and return, including returning to a different branch.
- Cancel with terms that depend on how close to pickup the cancellation is.
Core classes
- Vehicle – One physical car: registration, class, current branch, status.
- VehicleClass – Economy, SUV, luxury - what is searched and priced, as against what is driven away.
- Branch / Location – Holds vehicles and accepts returns.
- Reservation – Customer, vehicle class, date range, branches, status.
- PricingStrategy – Base rate by class and duration, composed with seasonal and add-on rules.
- InventoryService – Answers availability for a class over a date range, which is an interval problem, not a boolean.
Design patterns that apply
- Strategy – Pricing varies by class, duration and season independently. One interface keeps those from multiplying into cases.
- Decorator – Add-ons stack: insurance on top of a child seat on top of the base rate. This is the clearest decorator use in the LLD set, and interviewers notice when it is reached for.
- Singleton – The inventory service, with the usual caveat about testability.
Follow-up questions to expect
- A customer reserves a class, not a car. When is a specific vehicle assigned, and what if it is returned late?
- One-way rental leaves a vehicle at the wrong branch. Does your model need a repositioning concept?
- Two reservations overlap by one hour. Is that a conflict, and where is that rule?
Where candidates lose marks
- Booking a specific Vehicle at reservation time, which blocks the fleet far more than real rental systems do.
- An available boolean rather than a date-range availability check.
- Add-ons as nullable fields on Reservation, so each new one changes the pricing code.