[ INFO ]category: System Design · Unknown difficulty: medium freq: Must first seen: 2026-03-13
[MEDIUM][UNKNOWN][MUST]
$catproblem.md
Practice/Amazon/Design a Parking Lot Management System
Design a Parking Lot Management System
Object Oriented DesignMust
Problem
Design and implement an object-oriented parking facility management system that can handle multiple types of vehicles across different parking levels. Your system should efficiently allocate parking spaces, track availability, and manage vehicle entry and exit operations.
This is a system design problem focused on demonstrating your ability to create clean, extensible object-oriented code with proper abstractions and relationships between entities.
Requirements
Your parking management system must support the following functionality:
Multiple Vehicle Types: Handle motorcycles, cars, and buses with different size requirements
Spot Classification: Different spot types (compact, regular, large) that can accommodate specific vehicle sizes
Multi-Level Structure: Support multiple parking levels/floors within the facility
Space Allocation: Automatically find and assign appropriate parking spots for incoming vehicles
Availability Tracking: Monitor which spots are occupied and which are available
Vehicle Operations: Handle both parking (check-in) and departure (check-out) of vehicles
Capacity Management: Track total capacity and current occupancy across the entire facility
Design Considerations
Extensibility: Your design should easily accommodate new vehicle types or spot classifications
Encapsulation: Each class should have clear responsibilities and hide implementation details
Type Safety: Use enums or constants for vehicle and spot types
Error Handling: Consider what happens when no spots are available or invalid operations occur
Scalability: The system should handle a large number of spots and levels efficiently
Core Components to Design
Your implementation should include these key classes:
Vehicle: Represents different types of vehicles with size information
ParkingSpot: Represents an individual parking space with type and availability status
ParkingLevel: Represents a floor containing multiple parking spots
ParkingLot: The main facade that manages the entire parking facility
Example Usage Scenario
`
Facility Setup:
Create a parking lot with 3 levels
Level 1: 10 compact spots, 20 regular spots
Level 2: 15 regular spots, 5 large spots
Level 3: 30 compact spots
Operations:
Motorcycle arrives → Assign compact spot on Level 1
Car arrives → Assign regular spot on Level 1
Bus arrives → Assign large spot on Level 2
Check available spots for cars → Return count of available regular spots
Motorcycle departs → Free its compact spot
Another car arrives → Assign available regular spot
`
Constraints
The system should handle up to 10 levels per facility
Each level can contain up to 1000 parking spots
Vehicle license plates are unique identifiers (strings)
Spots should be assigned on a first-available basis within the appropriate level
A motorcycle can park in any spot type (compact, regular, or large)
A car requires at least a regular spot (cannot use compact)