import java.util.Random; /** * Write a description of class CustomerQueue here. * * @author Jerediah Fevold * @version 20 October 2006 */ public class TicketAgent { // instance variables - replace the example below with your own private int limit = 0; private int count = 1; private int custnum = 0; /** * Constructor for objects of class CustomerQueue */ public void TicketAgent() { Random generator = new Random(); int r = generator.nextInt(20) + 10; Line line = new Line(); Random custEnter = new Random(); while(r != 0 ) { int custEnt = custEnter.nextInt(500); if(custEnt == 250 && count < limit) { Customer customer = new Customer(count); line.enqueue(customer); System.out.println("Customer " + count + " has been added to the line."); custnum = custnum + 1; count = count + 1; } if(custEnt == 150 && custnum > 0) { String peek = line.peekFront().toString(); line.dequeue(); System.out.println("Customer " + peek + " has been removed from the line."); r = r - 1; custnum = custnum - 1; } } } }