import java.util.*; /** * Write a description of class TicketAgent here. * * @author Jerediah Fevold * @version 3 Nov 06 */ public class TicketAgent { public static void main(String[] args) { // instance variables int rand1 = 0; int custNum = 0; int inLine = 0; int customers = 0; String front = ""; Line line = new Line(); Random randNum = new Random(500); Random randCust = new Random (25); customers = randCust.nextInt(); while(customers > 0) { rand1 = randNum.nextInt(); if(rand1 == 250) { line.enqueue(new Customer(custNum)); custNum = custNum + 1; inLine = inLine + 1; System.out.println(front + "has entered the queue"); } if(rand1 == 150 || inLine > 0) { front = line.peekFront().toString(); line.dequeue(); System.out.println(front + "has left the queue"); inLine = inLine - 1; customers = customers - 1; } } } }