Giter VIP home page Giter VIP logo

swapniltake1 / elevator Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 3 KB

This is a Java-based elevator simulator program that demonstrates the functionality of a single-threaded elevator system. The program is designed using core Java concepts, including object-oriented principles and the collection framework. The simulator allows users to call the elevator, board passengers, and move between floors.

Java 100.00%
collection-frameworks elevator java object-oriented-programming practice-project simulation single-threaded

elevator's Introduction

Elevator (Task 1 - YHills Java Training)

Q. Design and code an Elevator. You can use any JDK, preferably JDK 8 and use collection framework, OOP principles to design a single thread elevator programme. This will test your knowledge of CORE Java. Remember to use all the standard and good programming habits while programming.

Flow Of Code

  1. The Elevator class maintains the current floor, direction of movement, a map of requested paths (people waiting on each floor and their destinations), and an array to track the floors the elevator will visit.

  2. The start() method repeatedly calls the processFloor() method until the elevator becomes idle.

  3. The processFloor() method unloads passengers, boards passengers, updates the current floor destinations, and calls moveElevator() to determine the next direction and move the elevator.

  4. The moveElevator() method determines the direction based on the current floor and updates the currentDirection variable accordingly.

  5. The elevator moves up or down based on the current direction and waits between each floor.

  6. The callElevator() method adds user requests to the requestedPathsMap.

  7. The main method creates an Elevator object, allows users to manually call the elevator, and starts the elevator.

Output Screenshot

image

elevator's People

Contributors

swapniltake1 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.