lab6ans - emptiestQueue(queues).add(new Customer(minute));...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
1. if (customerArrives(ARRIVAL_PROBABILITY)) q.add(new Customer(minute)); for (int i = 0; i < NUM_REGISTERS; i++) { Customer customer = q.remove(); numCustomers++; totalWaitTime += minute - customer.getTimeEnteredQueue(); registerAvailableTimes[i] = minute + customer.getTimeNeededAtRegister(); } } 2. if (customerArrives(ARRIVAL_PROBABILITY))
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: emptiestQueue(queues).add(new Customer(minute)); for (int i = 0; i &lt; NUM_REGISTERS; i++) if (registerAvailableTimes[i] &lt;= minute &amp;&amp; !queues[i].isEmpty()) { Customer customer = queues[i].remove(); numCustomers++; totalWaitTime += minute - customer.getTimeEnteredQueue(); registerAvailableTimes[i] = minute + customer.getTimeNeededAtRegister(); } }...
View Full Document

This note was uploaded on 12/19/2009 for the course CS 121 taught by Professor Reid-miller during the Spring '09 term at Carnegie Mellon.

Ask a homework question - tutors are online