// Helene Martin, CSE 142 // Simulates drawing up to 10 lotto numbers and stopping if a 7 is drawn. import java.util.*; public class Lotto { public static void main(String[] args) { Random r = new Random(); boolean gotASeven = seven(r); System.out.println(gotASeven); } // picks up to 10 lotto numbers. If a 7 is picked, stops and returns true. // If no 7 was picked, returns false after 10. public static boolean seven(Random rand) { for (int i = 0; i < 10; i++) { int num = rand.nextInt(30) + 1; System.out.print(num + " "); if (num == 7) { return true; } } return false; // can only say no 7 was seen after all numbers were drawn } }