Skip to content

brayvid/elevator-simulator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Elevator Simulator

An interactive graphical elevator simulation written in Java with a Swing GUI. The simulation implements the LOOK algorithm to schedule elevator sweeps, manage travel direction, and coordinate passenger boarding and drop-offs.

Directory Structure

Ensure your files are placed in a subdirectory named java-elevator:

java-elevator/
├── Building.java
├── Button.java
├── DestButton.java
├── Direction.java
├── Elevator.java
├── Floor.java
├── FloorRequest.java
├── Lobby.java
├── MiddleFloor.java
├── Rider.java
├── Roof.java
├── UpDownButton.java
└── Visualizer.java

Prerequisites

  • Java Development Kit (JDK): Version 8 or higher is required to compile and run the application.

How to Run

Follow these steps in your terminal or command prompt:

  1. Navigate to the project subdirectory:

    cd path/to/java-elevator
  2. Compile all source files:

    javac *.java
  3. Run the visualizer:

    java Visualizer

Using the Simulator

  • Call an Elevator: Click the ▲ (UP) or ▼ (DOWN) buttons on the left side of any floor line. This spawns a passenger and calls the elevator to that floor.
  • Select Destination: When a passenger boards, an interactive control panel pop-up will appear. Click a floor button on the panel to select their destination floor.
  • LOOK Algorithm Sweeping: The elevator travels continuously in its active direction (UP or DOWN), dropping off occupants and picking up waiting passengers traveling in that same direction. It only reverses course when no requests remain ahead of it.
  • Arrived Passengers: Once a passenger reaches their destination, they are marked Done and removed.

Example Usage

Elevator Simulator Demo


© Copyright 2026 Blake Rayvid. All rights reserved.

About

An elevator simulation demonstrating object-oriented programming.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Contributors

Languages