예제 #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());
   }
 }
예제 #2
0
 @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());
   }
 }