// Guessing game - repeatedly guess the number the computer has in its mind //... import java.util.Scanner; class GuessingGame { int MAX = 50; int secretNumber; int guess; int numTries; String prompt; boolean found; Scanner scanner; void play() { scanner = new Scanner( System.in ); // choose a random number secretNumber = (int) (Math.random() * MAX + 1); prompt = "Guess number between 1 and "+MAX; found = false; numTries = 1; while (!found) { System.out.println( prompt ); guess = scanner.nextInt(); //... } } public static void main(String[] a) { new GuessingGame().play(); } }