figure computer science laboratory printing queuewe could decide by building simulation that models the laboratory we will need to construct representations for studentsprinting tasksand the printer (figure as students submit printing taskswe will add them to waiting lista queue of print tasks attached to the printer when the printer completes taskit will look at the queue to see if there are any remaining tasks to process of interest for us is the average amount of time students will wait for their papers to be printed this is equal to the average amount of time task waits in the queue to model this situation we need to use some probabilities for examplestudents may print paper from to pages in length if each length from to is equally likelythe actual length for print task can be simulated by using random number between and inclusive this means that there is equal chance of any length from to appearing if there are students in the lab and each prints twicethen there are print tasks per hour on average what is the chance that at any given seconda print task is going to be createdthe way to answer this is to consider the ratio of tasks to time twenty tasks per hour means that on average there will be one task every seconds hour minute task tasks hour minutes seconds seconds for every second we can simulate the chance that print task occurs by generating random number between and inclusive if the number is we say task has been created note that it is possible that many tasks could be created in row or we may wait quite while for task to appear that is the nature of simulation you want to simulate the real situation as closely as possible given that you know general parameters main simulation steps here is the main simulation create queue of print tasks each task will be given timestamp upon its arrival the queue is empty to start queues