// Project: Observer // Module: casino // Source code file: Main1.java. // The Manager object is the observer. // The SlotMachine objects are the observables. public class Main1 { public static void main(String[] args) { SlotMachine machine = new SlotMachine(1325); // Play the slot machine 10 times. for(int i = 0; i <= 10; i++) { machine.play( ); System.out.println(machine); } // Play slot machine 10000 times. // Count the number of jackpots (|7|7|7|). System.out.println( ); System.out.print("Number of jackpots: "); int nJackpots = 0; for(int i = 0; i <= 10000; i++) { machine.play( ); if (machine.isJackpot( )) { System.out.println("Jackpot. " + (++nJackpots)); } } } }