Skip to main content
PreparationZone Logo
PrepZone

Design a Parking Lot System

CampusOS parking — spots, tickets, pricing by vehicle type.

Pass checkpoint below

Why this matters

  • One of the most common LLD prompts — patterns for allocation, ticketing, and pricing appear everywhere.
  • Tests OOP, Strategy, and facade coordination in a single story.
  • CampusOS parking is the reference machine problem for the rest of the track.
ParkingLotentry facade
ParkingFloorcollection of spots
Ticketissued on entry
Vehiclecar, bike, truck

ParkingSpot links Vehicle when occupied; Strategy picks spot by vehicle type.

ParkingLot owns floors; each spot knows its size and occupant.

Requirements

Functional

  • Multiple spot types: handicapped, compact, large, motorcycle
  • Vehicle types: car, truck, van, motorcycle — each maps to compatible spots
  • Entry issues a ticket; exit calculates hourly fee and frees the spot
  • Display board shows availability per spot type; show "FULL" when capacity reached
  • Multiple entry and exit gates share one lot

Non-functional

  • In-process, single JVM for this article
  • Spot assignment must be consistent under concurrent entry at two gates
  • Pricing rule should be replaceable (Strategy) without editing ParkingLot

The rest of this guide is part of Pro

Free covers every fresher guide in full. Pro unlocks Senior, Staff and Architect guides across every track.

Still to come · 4 sections

  • Core classes
  • Entry and exit flow
  • Extensions
  • CampusOS extension

Test yourself

Answer these before moving on — recall is what makes it stick.