public class Casino{

  private SlotMachine[] mySlotMachines;
  //private int numTokens;

  public Casino(){
    mySlotMachines = new SlotMachine[6];
    mySlotMachines[0] = new SlotMachine("Alpha", 4);
    mySlotMachines[1] = new SlotMachine("Bravo",7);
    mySlotMachines[2] = new SlotMachine("Charlie",3);
    mySlotMachines[3] = new FancySlotMachine("Delta",6);
    mySlotMachines[4] = new FancySlotMachine("Epsilon",10);
    mySlotMachines[5] = new FancySlotMachine("Foxtrot",5);
  }

  public SlotMachine getSlotMachine(int i){
  	return mySlotMachines[i];
  }


 public static void main(String[] args){
   int i = 0; //counter for array loop
   int numTokens = 0; //input value from user
   String cont = new String("y");//input continue value from user

   Casino CeasarsAqueduct = new Casino();

   System.out.println("Welcome to Ceasar's Aqueduct! How many tokens do you have?");
   //read in number of tokens from user
   java.io.BufferedReader stndin;
   stndin = new java.io.BufferedReader(new java.io.InputStreamReader(System.in));
   try {
   	numTokens = Integer.valueOf(stndin.readLine()).intValue();
   } catch (Exception e){
   	e.printStackTrace();
   }

   //program loop:
   while ((numTokens > 0)&&(cont.equals(new String("y")))){
   	System.out.print("Keep playing?("+numTokens+" tokens left) y/n:");

   	//input y/n from user
   	try {
      		cont = stndin.readLine();

   	} catch (Exception e){
   		e.printStackTrace();
   	}

   	if ((numTokens > 0)&&(cont.equals(new String("y")))){
   		//take token from user and play the next slot machine in the array
   		numTokens --;
   		SlotMachine currSlot = CeasarsAqueduct.getSlotMachine(i);
   		int pay = currSlot.play();
   		numTokens = numTokens + pay;
   		i++;
   		//check to see if we need to re-start at the first slot machine
   		if (i>5) i =0;


   	}//fi
   }//while
   System.out.println("Come again soon to Ceasar's Aqueduct!");
 }//main

}//Casino