import java.util.Scanner;

/**
 * Class that simulates a single-teller bank serving customers.
 *   @author Dave Reed
 *   @version 4/18/05
 */
public class BankSimulator
{
    public static void main(String[] args)
    {
	    Scanner input = new Scanner(System.in);
	    System.out.print("What is the time duration (in minutes) to be simulated? ");
	    int maxTime = input.nextInt();
	    System.out.print("What percentage of the time (0-100) does a customer arrive? ");
	    int arrivalProb = input.nextInt();
	
	    ServiceCenter bank = new ServiceCenter();
        while (bank.getTime() <= maxTime || bank.customersRemaining()) {
            if (bank.getTime() <= maxTime && customerArrived(arrivalProb)) {
                bank.addCustomer();
            }
            bank.doBusiness();
        }
	    bank.displayStats();
	}
	
	private static boolean customerArrived(int prob)
	{
	    return (Math.random()*100 <= prob);
	}
}
