Earn Higher Grades With Instant Assignment Help.Ask Question!

Java Programming
(5/5)

queue to simulate the row of customers through a checkout line in a store. In order to create this simulation, you must model both the passage of time and the row of customers through the line.

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

You need to use a queue to simulate the row of customers through a checkout line in a store. In order to create this simulation, you must model both the passage of time and the row of customers through the line. You can model time using a loop in which each pass corresponds to a set time interval – one minute, for example. You can model the row of customers using a queue in which each element corresponds to a customer in the line.

In order to complete the simulation, you need to know the rate at which customers join the line, as well as the rate at which they are served and leave the line. Suppose the checkout line has the following properties.

  • One customer is served and leaves the line every minute (assuming there is at least onecustomer waiting to be served during that minute).
  • Between zero and four customers join the line every minute according to the followingprobability:
Customer s Arriving Probabilit y
0 0.3
1 0.2
2 0.2
3 0.1
4 0.2
  • You can simulate the row of customers through the line during a time period n minuteslong 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. If k is < 0.3, then do not add any customers to the line. If k is < 0.5, then add one customer to the line. If k is < 0.7, then add two customers to the line. If k is < 0.8, then add three customer to the line. Otherwise (if k ≥ 0.8), add four customers to the line.

}

Step 1: Create a program that uses the Java Queue ADT to implement the model described above. Your program should update the following information during each simulated minute, that is, during each pass through the loop:

The total number of customers served

  1. The combined length of time these customers spent waiting in line
  2. The maximum length of time any of these customers spent waiting in line

In order to compute how long a customer waited to be served, you need to store the “minute” that the customer was added to the queue as part of the queue element corresponding to that customer.

Step 2: Use your program to simulate the row of customers through the line and complete the following table. Note that the average wait is the combined waiting time should be derived from the “combined length of time” calculated in step 1 part b. Take special note that, in this program, the length of the simulation is entered by the user.

deliverables:

  • Complete NetBeans project in zip format
  • Video explaining your code (while showing the code in NetBeans)
Attachments:
(5/5)

Related Questions

CSI 1420 Introduction to C Programming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C

DescriptionIn this final assignment, the students will demonstrate their ability to apply two majorconstructs of the C programming language – Fu

The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an

Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t

Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual

Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th

SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

Ask This Assignment To Be Done By Our ExpertsGet A+ Grade Solution Guaranteed

expert
joyComputer science
(4/5)
12 Answers Hire Me
expert
Robert DLaw
(4.8/5)
533 Answers Hire Me
expert
Dr Samuel BarberaStatistics
(5/5)
815 Answers Hire Me
expert
Tutor For YouEconomics
(5/5)
701 Answers Hire Me