Coder Social home page Coder Social logo

queue-simulation's Introduction

Live demo: https://kacperbak.pl/queue-simulation/

Task topic: Simulating a queue of customers in an office

Task Description:

As a solution, it is necessary to implement a simulation along with its configuration. The configuration should allow changing basic information, i.e. the number of available positions (and thus the number of queues on which all movements will be spread), the minimum time a customer needs to handle their case at the office, and the maximum time they need for this action. The time needed to handle a case is given as an integer value greater than 0.

The second part of the application is responsible for the simulation itself. The user who uses the application should have access to 2 buttons.

Button 1 - adding a new person to the queue. After clicking, a new person is created. The time required for a given person to handle their case is randomly generated. The minimum and maximum values are read from the configuration screen. For example, if the minimum value is 5 and the maximum is 8, the random time can be from the range [5,8]. After properly generating the customer, they are sent to the queue in which they will be admitted to the window at the office as quickly as possible.

Example:

Queue 1: 2, 4, 6
Queue 2: 10
Queue 3: 1, 3

A new person will be added to queue 3.

Button 2 - parallel reduction of the time required to handle their case. After pressing this button, all people who are currently at the window will have their required time reduced by 1. If the value drops to 0, the customer is removed from the queue and the next person is served.

Example:

Queue 1: 2, 4, 6
Queue 2: 10
Queue 3: 1, 3

After pressing the button:
Queue 1: 1, 4, 6
Queue 2: 9
Queue 3: 3

All events (adding a new person to the queue, updating times) for the purpose of simplifying the task should be handled by clicking the button. There is no need to prepare event handling using setInterval or setTimeout.

Technological stack:

  • React
  • Testing Library
  • React Router DOM

Starting the preliminary application:

  1. After copying and unpacking the starter files, you should install the necessary dependencies with the command yarn install or npm install
  2. Then, type the command yarn dev or npm run dev
  3. The preliminary application will be available at http://localhost:5173/

Functional requirements:

  • Simulating the distribution of a queue across several positions
  • Calculation of the time required to handle the entire queue
  • Adding new people to the queue
  • Parallel reduction of the time required to handle the case by all customers who are currently at the position
  • Preliminary simulation configuration
  • Displaying all queues

Sample application:

Simulation configuration screen

Simulation screen

Additional information:

  • In the /src/assets/images directory, there are graphics that can be used in the application.
  • Their use is obligatory, there is no imposed requirement on how the application should look.
  • The application should be as simple as possible, but it must meet all functional requirements.

Tests:

The React Testing Library has been configured in the project. If you feel...

queue-simulation's People

Contributors

adcichowski avatar dependabot[bot] avatar kbakdev avatar

Stargazers

 avatar

Watchers

 avatar

queue-simulation's Issues

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.