notes the state of the system being simulated is represented by the two variables serverbusy and numberinqueue the first is boolean value which indicates whether the server is busy the second keeps track of the number of customers in the queue in addition to the state variablesthere are two instances of the class exponentialrv it implements the randomvariable interface defined in program this interface defines method called nextdouble which is used to sample the random number generator every time nextdouble is calleda different (randomresult is returned the random values are exponentially distributed around mean value which is specified in the constructor for examplein this case both servicetime and interarrivaltime produce random distributions with the mean value of (lines - it is assumed that the eventlist priority queue is initially empty the simulation begins by enqueueing customer arrival at time zero (line the while loop (lines - constitutes the main simulation loop this loop continues as long as the eventlist is not emptyi as long as there is an event to be simulated each iteration of the simulation loop begins by dequeuing the next event in the event list (line if the time of that event exceeds timelimitthe event is discardedthe eventlist is purgedand the simulation is terminated otherwisethe simulation proceeds the simulation of an event depends on the type of that event the switch statement (line invokes the appropriate code for the given event if the event is customer arrival and the server is not busyserverbusy is set to true and the servicetime random number generator is sampled to determine the amount of time required to service the customer customer departure is scheduled at the appropriate time in the future (lines - on the other handif the server is already busy when the customer arrivesi add one to the numberinqueue variable (line another customer arrival is scheduled after every customer arrival the interarrivaltime random number generator is sampledand the arrival is scheduled at the appropriate time in the future (lines - if the event is customer departure and the queue is emptythe server becomes idle (lines - when customer departs and there are still customers in the queuethe next customer in the queue is served thereforenumberinqueue is decreased by one and the servicetime random number generator is sampled to determine the amount of time required to service the next customer customer departure is scheduled at the appropriate time in the future (lines - clearly the execution of the simulation method given in program mimics the modeled system of coursethe program given produces no output for it to be of any practical valuethe simulation program should be instrumented to allow the user to study its behavior examplethe user may be interested in knowing statistics such as the average queue length and the average waiting time that customer waits for service and such instrumentation can be easily incorporated into the given framework -heaps the -ary heap or -heap is priority queue data structurea generalization of the binary heap in which the nodes have children instead of thusa binary heap is -heap the -ary heap consists of an array of itemseach of which has priority associated with it these items may be viewed as the nodes in complete -ary treelisted in breadth first traversal orderthe item at position of the array forms the root of the treethe items at positions - are its childrenthe next items are its grandchildrenetc thusthe parent of the item at position (for any is the item at position ceiling(( )/dand its children are the items at positions di through di according to the heap propertyin min-heapeach item has priority lovely professional university