Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Simulation of Multiple Queues A supermarket can serve multiple queues of customers. Whenever a queue gets too long, some customers will automatically switch to another

Simulation of Multiple Queues
A supermarket can serve multiple queues of customers. Whenever a queue gets too long, some customers will automatically switch to another queue. In this assignment you are asked to simulate such a queue known as a double ended queue where you can enqueue and then dequeue from either end. In our application we only need to enqueue to the back, there is no need to for enqueue to the front.
In this assignment, you will use fixed arrays to represent the queues. In this assignment you will create at least
4
queues to simulate such a queueing system in a supermarket. You can assume that each customer has a unique name
(
ie
.
Create a pool of Strings eg
.
5
0
to assign to each queue
)
.
The program will randomly assign the names to the queues
(
so some queues will eventually be longer than other queues
)
.
Every time when assigning, the difference in length of one queue compared to others is more than
3
,
you will dequeue from the back of the queue and reassign randomly to one of the other queues. Eventually you will have
4
queues
(
The longest and shortest queue will differ by at most
3
)
.
pls write a java script with solution

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Students also viewed these Databases questions