Requirements
- System supports three vehicle types: Motorcycle, Car, Large Vehicle
- When a vehicle enters, system automatically assigns an available compatible spot
- System issues a ticket at entry.
- When a vehicle exits, user provides ticket ID
- System validates the ticket
- Calculates fee based on time spent (hourly, rounded up)
- Frees the spot for next use
- Pricing is hourly with same rate for all vehicles
- System rejects entry if no compatible spot is available
- System rejects exit if ticket is invalid or already used
Out of scope:
- Payment processing
- Physical gate hardware
- Security cameras or monitoring
- UI/display systems
- Reservations or pre-booking
Entities & Relationship
- ParkingLot - the main orchestrator, handles entry and exits, fare calculation, ticket validation, checks spot availability
- ParkingSpot - holds information like id, spot type, availability
- Ticket - id, entry timestamp for fare calculation, parking spot id, vehicle type(?)
Class Design
SpotType
MOTORCYCLE
CAR
LARGE
VehicleType
MOTORCYCLE
CAR
LARGE
ParkingSpot
- id
- spot_type
- status
+ get_id()
+ get_spot_type()
+ get_status()
+ mark_free()
+ mark_occupied()
Ticket
- id
- parking_spot_id
- entry_timestamp
+ get_id()
+ get_parking_spot_id()
+ get_entry_timestamp()
ParkingLot
- active_tickets : map<ticket_id, Ticket>
- parking_spots : list<ParkingSpot>
- hourly_rates : map<VehicleType, rate>
+ enter(VehicleType) -> Ticket
+ exit(ticket_id) -> long