Data Structure Using C++ Queue Project You can Use STL with the queue just please look at picture 1 to write a code please need a full code without errors and like the question need please We can use a queue to simulate the flow of customers through a check-out line in a store. In this simulation we will have the following details: one check-out line the expected service time for each customer is one minute (However, they may have to wait in line before being serviced) between zero and two customers join the line every minute We can simulate the flow of customers through the line during a time period n minutes long using the following algorithm: Initialize the queue to empty. for ( minute = 0 ; minute < n ; ++minute ) {       if the queue is not empty, then remove the customer at the front of the queue.       Compute a random number k between 0 and 3.       If k is 1, then add one customer to the line.       If k is 2, then add two customers to the line.       Otherwise (if k is 0 or 3), do not add any customers to the line. } In addition, the algorithm will keep track of the following: the total number of customers served the combined total wait time of all customers the maximum length of time any of these customers spent waiting in line Operations on the Queue for the Check-out Line Simulation Given a time of 5 minutes, the following demonstrates the operations on the queue: picture number 1 then picture number 2  please help me with new code

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Data Structure Using C++ Queue Project

You can Use STL with the queue just please look at picture 1 to write a code

please need a full code without errors and like the question need please

We can use a queue to simulate the flow of customers through a check-out line in a store. In this simulation we will have the following details:

  • one check-out line
  • the expected service time for each customer is one minute (However, they may have to wait in line before being serviced)
  • between zero and two customers join the line every minute

We can simulate the flow of customers through the line during a time period n minutes long using the following algorithm:

Initialize the queue to empty.

for ( minute = 0 ; minute < n ; ++minute )

{

      if the queue is not empty, then remove the customer at the front of the queue.

      Compute a random number k between 0 and 3.

      If k is 1, then add one customer to the line.

      If k is 2, then add two customers to the line.

      Otherwise (if k is 0 or 3), do not add any customers to the line.

}

In addition, the algorithm will keep track of the following:

  • the total number of customers served
  • the combined total wait time of all customers
  • the maximum length of time any of these customers spent waiting in line

Operations on the Queue for the Check-out Line Simulation

Given a time of 5 minutes, the following demonstrates the operations on the queue:

picture number 1

then picture number 2 

please help me with new code 

 

minute
queue operations
corresponding diagram
isempty?
yes
no degueue (empty queue)
1 engueue(0)
1
no
degueue
2 engueue(1)
engueue(1)
2
no
1
degueue
1
2 engueue(2)
engueue(2)
1
2
2
no
1
2
2 H2 .
degueue
1 engueue(3)
2 H 2
3
4
no
2
2
degueue
3
O no engueue (k=0)
2
3
Transcribed Image Text:minute queue operations corresponding diagram isempty? yes no degueue (empty queue) 1 engueue(0) 1 no degueue 2 engueue(1) engueue(1) 2 no 1 degueue 1 2 engueue(2) engueue(2) 1 2 2 no 1 2 2 H2 . degueue 1 engueue(3) 2 H 2 3 4 no 2 2 degueue 3 O no engueue (k=0) 2 3
Test Plan for "Check-out Line" Simulation Program
Total Number of
Time (minutes)
Average Wait Longest Wait
Customers Served
30
60
120
480
Transcribed Image Text:Test Plan for "Check-out Line" Simulation Program Total Number of Time (minutes) Average Wait Longest Wait Customers Served 30 60 120 480
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Lists
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education