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) { int rand1 = 0; int custNum = 1; int inLine = 0; int customers = 0; int custInt = 0; String front = ""; Line line = new Line(); Random randNum = new Random(); Random randCust = new Random (); customers = randCust.nextInt(20) + 10; System.out.println(customers); while(customers > 0) { rand1 = randNum.nextInt(500); if(rand1 == 250) { line.enqueue(new Customer(custNum)); custNum = custNum + 1; inLine = inLine + 1; System.out.println("Customer " + custNum + " 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; } } } }