Limited number of tires to a simple game? : How would I limit the tries of a simple game to just three? I would think you would use a boolean. But not sure.

    import java.util.Scanner;

public class guess {

	public static void main(String[] args) {

		int randomN = (int) (Math.random() * 10) + 1;

		Scanner input = new Scanner(System.in);
		int guess;
		System.out.println("Enter a number between 1 and 10.");
		System.out.println();

		do {
			System.out.print("Enter your guess: ");
			guess = input.nextInt();

			if (guess == randomN) {
				System.out.println("You won!");
			} else if (guess > randomN) {

				System.out.println("Too high");
			} else if (guess < randomN) {
				System.out.println("Too low");
			} 
		

		} while (guess != randomN);
	}

}