Esempio n. 1
0
 public void turnCrank() {
   System.out.println("You turned...");
   int winner = randomWinner.nextInt(10);
   if (winner == 0) {
     gumballMachine.setState(gumballMachine.getWinnerState());
   } else {
     gumballMachine.setState(gumballMachine.getSoldState());
   }
 }
 @Override
 public void tumCrank() {
   System.out.println("You turned...");
   int winner = rnd.nextInt(10);
   if (winner == 0 && gumballMachine.getCount() > 1) {
     gumballMachine.setState(gumballMachine.getWinnerState());
   } else {
     gumballMachine.setState(gumballMachine.getSoldState());
   }
 }
 public void turnCrank() {
   System.out.println("You turned...");
   gumballMachine.setState(gumballMachine.getSoldState());
 }
 @Override
 public void turnCrank() {
   System.out.println("You turned crank!");
   machine.setState(machine.getSoldState());
   machine.dispense();
 }