Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Simulation of Multiple Queues siked to simulate meh a quase known as a double euded qusue whare you can encresa and is no zoed to

Simulation of Multiple Queues
siked to simulate meh a quase known as a double euded qusue whare you can encresa and
is no zoed to for eogreas to the from.
difference in langth of one qasus compared to obern is mors then 3, you will dequeus from
will have 4 qaeas (The lengost ind tharteat quene will differ by at most 3).
1 Setting up
fint Corts a Doubla Fided Quse clas to model fe quese for fis application.
z Supermarket: Queuetp
Add a method public void quasep (String name) to your Supermarket class,
will rodomb select a qarue for the customer to add to. If the differeace is more than 3 for
3 DoubleEndedQueue: Enqueue
Add a mathod pablic void engrese (String name) to your Snpermarket class,
which will all ow the wer to add a custemer to the qasus.
4 DoubleEndedQueue: Dequeue from the Front
Add a metod pablic String deqaouFromfreat 0 to your Supermarket elass
which will allow the uses to remivo 2 castouser from the frout of the quaue. If there are no
pervous in the quasu, then it thould wom 3 mill.
5 DoubleEndedQueue: Dequeue from the Back
Add a mothod public String dequeusiromBack 0 to your Supermarket class,
which will allow the user to ramove a customer from the back of the queve. If thare uro no
pervons in the quaue, then it should rocus a wall.
6 Supermarket: Serve Customer
Add a mothod pubbe boolonn earvoCustomer() which will nomdomly pick a queue
to deguene from the front to your Supermark ot class. Whenover a queue is
emptied too quickly compared to the rest, the difference of maximum 3 betwoen
syy 2 queas must be adhered to.
image text in transcribed

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

More Books

Students also viewed these Databases questions

Question

Do intentions affect behaviour?

Answered: 1 week ago

Question

3. Evaluate your listeners and tailor your speech to them

Answered: 1 week ago