Problem Statement
Outline an LLD for a Parking Lot system supporting multiple vehicle types and fee calculation.
Explanation
Identify entities: ParkingLot, Floor, Spot, Ticket, Vehicle, RateCard, Payment. Use Strategy for pricing so rules vary by type and duration. A SpotSelector chooses an appropriate spot based on vehicle type and availability.
Repositories manage persistence per aggregate (e.g., Ticket as root). Keep commands like enter(vehicle) and exit(ticketId). Ensure concurrency safety with atomic spot allocation and ticket issuance.
Code Solution
SolutionRead Only
interface Pricing{ moneyFor(entry, exit, type): Money }
class Ticket{ id; spotId; entryTime; }Practice Sets
This question appears in the following practice sets:
