/* *Com S 207 *Hw 5 *SlotMachine.java */ import java.util.Scanner; import java.util.Random; public class SlotMachine { public static void main(String[]args){ Random rand = new Random(); Scanner scan = new Scanner(System.in); int digi1, digi2, digi3, cmd; digi1 = rand.nextInt(10); digi2 = rand.nextInt(10); digi3 = rand.nextInt(10); cmd = 1; while(cmd != 0) { if(cmd == 1) { digi1= rand.nextInt(10); digi2 = rand.nextInt(10); digi3 = rand.nextInt(10); } System.out.println(digi1+ " " + digi2 + " " + digi3); if(digi1== digi2 && digi2 == digi3) System.out.println("Jackpot!"); else if (digi1== digi2 || digi2 == digi3 || digi1 == digi3) System.out.println("Two numbers match."); else System.out.println("No match!"); System.out.println("Enter 0 to quit or 1 to continue."); cmd = scan.nextInt(); } } }