Question: Need the code in C++. Thankyou TITLE QUEUEING SIMULATION INTRODUCTION A queue is a sequence of elements, all of the same type, to which elements

Need the code in C++. Thankyou TITLE

QUEUEING SIMULATION

INTRODUCTION

A queue is a sequence of elements, all of the same type, to which elements can be appended at one end (the rear of the queue) and from which elements can be removed at the other end (the front). Queues are first-in-first-out (FIFO) structures that mimic the behavior of such systems as people in lines, cars at traffic lights, and files to be printed.

A queueing system consists of one or more queues of elements waiting to be served by one or more servers. When an element is removed from the front of a queue, a server serves that element. How queues and servers interact and parameters such as the numbers of queues and servers, how often new elements arrive, and how often servers remove elements from queues determine the behavior of a queueing system.

A queueing simulation is a program that simulates a queueing system. A probabilistic simulation calls a pseudo-random number generator to determine if events occur, and their parameters, at each tick of the simulation's clock.

DESCRIPTION

Design, implement, test, and document a probabilistic simulation of a queueing system with several queues and several servers, one server for each queue, as in a grocery or discount store. Because there are several lines, each arriving customer always joins the line that is currently the shortest. If several lines are equally short, the new arrival may join any one of them. A line with a free teller is "shorter" than one whose teller is occupied. Once in a line, a customer does not leave it until served.

The program will read from the terminal the parameters of the simulation---how many queue/server pairs, the longest time for a transaction, the probability that a customer arrives during a single tick, the duration of the simulation---and a seed value for the random number generator. It will simulate the queueing system for the specified duration, showing a picture of the system at every clock tick, then report some statistics: the average time each customer waited, the longest time any customer waited, the number of customers served, and the numbers of customers left in queues.

The number of queue/server pairs, of course, is at least 1. The probability that a customer arrives during one tick is a percentage, thus an integer between 0 and 100. Each transaction's time is random, uniformly distributed between one tick and a positive maximum value entered from the terminal.

INPUT

From the terminal the program will read:

the number of queue/server pairs (lines and their tellers),

the probability that a customer will arrive in a single tick (a percentage, thus an integer between 1 and 100);

the longest time a transaction may take, a positive integer;

the duration of the simulation in ticks, at least 1; and

an integer seed value for the pseudo-random number generator.

OUTPUT

The program's output, directed to the terminal, will be a snapshot of the system at each clock tick during the simulation, followed by these statistics:

the number of customers served,

the average time (number of ticks) the customers who were served waited,

the longest time any one customer waited, and

the number of customers left in queues when the simulation terminated.

ERRORS

The program may assume that the input values are as described above; it need not detect any errors.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!