Skip to main content
PreparationZone Logo
PrepZone

Design an Elevator System

Multi-car, multi-floor scheduling with state-driven door logic.

Pass checkpoint below

Why this matters

  • Multiple elevators serve multiple floors in one building
  • Scope — what "State machine" covers inside Elevator System and what it does not
  • Scope — what "Scheduling" covers inside Elevator System and what it does not
  • Scope — what "Concurrency" covers inside Elevator System and what it does not
  • Machine problems test State, Strategy, and facade coordination.
Idle
Moving
DoorOpen
Idle
State pattern keeps door logic separate from movement logic.

CampusOS context

CampusOS is the fictional smart-campus platform used across this track. Treat this module as a real product slice:

Context

  • Belongs to CampusOS — same naming and design vocabulary as parking, library, and booking modules
  • Scope is one JVM — persistence is in-memory or behind a repository interface
  • Goal is a class diagram + core Java that an interviewer can follow in 35–45 minutes
  • Extension paragraph at the end links to System Design when scale exceeds one process

Requirements snapshot

Functional requirements

  • Multiple elevators serve multiple floors in one building
  • Passengers request up/down on a floor or select destination inside the car
  • Elevator moves floor-by-floor; doors open on arrival, close before moving
  • Scheduler picks which car serves a request (nearest, SCAN, or simple FIFO)
  • Display panel shows current floor and direction per car
  • Emergency stop halts movement and opens doors safely

Non-functional requirements

  • Thread-safe scheduler if multiple requests arrive concurrently
  • Deterministic state transitions per elevator car
  • Scheduling algorithm pluggable (Strategy pattern)
  • In-process simulation; no real hardware drivers required

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 · 6 sections

  • Overview
  • Requirements
  • State machine
  • Scheduling
  • Concurrency
  • CampusOS extension

Test yourself

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