In this assignment, you will write a simulator to determine maximum, minimum and
ID: 3697590 • Letter: I
Question
In this assignment, you will write a simulator to determine maximum, minimum and average queue length. Important: You can implement with the linked list classes described in Chapter 20 or the queueing structures described in Chapter 21.
The user inputs the following information
a. The relative weight of arrivals. This is an integer between 1-100.
b. The number of servers. This is an integer between 1-25.
c. The relative weight of a server. This is an integer between 1-100.
d. Thetotalnumberofevents,i.e.thetotalnumberofeventssimulated.
Here’s how the information in 1) is used. The total number of possible events is arrival weight + (number of servers * server weight). For example: If a) is 50, b is 10, c is 10 then c = 50 + (10*10) = 150.
Let’s call that result “event possibilities”. You will simulate the number of events in d). For each event, you will randomly pick one of the event possibilities. Thus, you will have to generate a random number that is evenly distributed over the number of event possibilities. Once you have picked an event possibility for the event:
If the event possibility is an arrival, you will add an event to your event queue. You will also record the event number (i.e. which event is this in d)) in the information maintained on the event in the queue.
If the event possibility is a server, you will remove the oldest event in the queue (the last one in a FIFO queue). If there are no elements in the queue, the server event essentially becomes a no-op, i.e. there is nothing to remove from the queue.
Once all of the events have been generated in d), if there are any events remaining in the queue, you will drain the queue by invoking your server logic to remove the entry until the queue becomes empty.
For each event simulation, you should report:
The simulation number
The length of the queue as of this event
If this is an arrival, the arrival #
If this is a server event, the server #
At the end of the event simulation, you should report
The number of simulations
The maximum length of the queue
c. The average length of the queue
d. The maximum number of arrivals in a row e. The maximum number of service’s in a row
Please make sure you comment your code thoroughly. My preferred style is to not comment every line of code, but instead have a block comment for every logical section and to use line comments when you want to emphasize something special that line of code does.
The code should be nicely formatted and should use proper variables and variable names. While we’ve sometimes jokingly used wacko variable names in class, please do not do so in your assignment.