Lift Simulation

< >

Description

This project was a lift simulator based on three test cases, results were displayed via: the console, a text area and an animation. The project was developed in Java using Swing to develop the graphical user interface of the application. MVC was the main design pattern used in this application, other design patterns included observer and factory.

Test case 1

The first test case had the preconditions that a user and the lift were both on the bottom floor. Then the user would walk to the lift and press the button. The doors would open, the user would enter the lift and press the button inside the lift to go to the top floor. Once at the top floor the user would exit the lift and walk to the end of the hallway.

Test case 2

The second test case had the preconditions that a user would start on the bottom floor, but the lift would start on the top floor. The user would walk to the lift, press the button and the lift would take 5 seconds to reach the bottom floor. The doors would then open, the user would enter the lift and go to the top floor. Once at the top floor the lift doors would open, and the user would walk to the end of the hallway.

Test case 3

The third test was the most complicated. The preconditions were that a user and the lift started on the top floor and at the same time 3 users started on the bottom floor. All users would start to walk towards the lift and attempt to press the button if not already pressed.

If the user on the top floor pressed the top button first, then the doors would open, and the user would enter and travel to the bottom floor and walk to end of the hallway. The three users would then enter the lift and head towards the top floor.

If the bottom users pressed the lift call button the lift would start to travel to the bottom floor. The three users on the bottom floor would enter the lift and head towards the top floor, exit the lift and walk to the end of the hallway. The top floor user would then enter the lift and proceed to go to the bottom floor.

Outcome

The project helped me to better understand the use of design patters such as factory, observer and MVC. A better understanding of multithreading was also achieved to make the users and lift work together.