Number Guessing Game : I'm trying to make a game where the user has 3 chances to guess a random number that the program generates. I have this code so far, but I don't know how to get the program to stop after the user inputs 3 out of 3 guesses. If the user is not able to correctly guess in 3 tries, I want the program to say "You loose. The number was ..."

    import java.util.Random;
    import java.util.Scanner;
    class GuessNumber {
	    public static void main(String args[]) {
		    Random random = new Random();
		    Scanner input = new Scanner(System.in);
		    int MIN = 1;
		    int MAX = 10;
		    int comp = random.nextInt(MAX - MIN + 1) + MIN;
		    int user;
		

        do {
			System.out.print("Guess a number between 1 and 10: ");
			user = input.nextInt();
			
			if (user > comp)
				System.out.println("My number is less than " + user + ".");
			else if (user < comp)
				System.out.println("My number is greater than " + user + ".");
			else
				System.out.println("Correct! " + comp + " was my number! " );
		} while (user != comp);
	}
}