Loading LLD design...
Design an object-oriented parking lot system that can manage vehicles of different sizes (motorcycle, car, bus) across multiple floors.
The system should efficiently assign spots, track availability, and calculate parking fees based on duration.
Park a vehicle
System should find and assign the nearest available spot
Unpark a vehicle
Free up the spot and calculate parking fee
Check availability
Query available spots by vehicle type
Calculate parking fee
Based on vehicle type and duration
Track capacity
Per floor and overall
Before diving into code, clarify the use cases and edge cases. Understanding the problem deeply leads to better class design.
Identify the primary actions users will perform. For a parking lot: park vehicle, exit vehicle, check availability. Each becomes a method.
Who interacts with the system? Customers, admins, automated systems? Each actor type may need different interfaces.
What are the limits? Max vehicles, supported vehicle types, payment methods. Constraints drive your data structures.
What happens on overflow? Concurrent access? Payment failures? Thinking about edge cases reveals hidden complexity.