I need help to figure it out how to keep track of how many guesses the user is making and NOT allow the user to guess any value thet had already tried. tHANK YOU
import java.util.Random;
import java.util.Scanner;
public class GuessingRand {
public static void main(String[] args) {
Random rand = new Random();
int guessNum = rand.nextInt(100);
int triesNum = 0;
Scanner input = new Scanner(System.in);
int guess;
boolean win = false;
while (win == false) {
System.out.println("Guess a number between 1 and 100: ");
guess = input.nextInt();
triesNum++;
if (guess == guessNum) {
win = true;
}
else if ( guess < guessNum ) {
System.out.println("Your guess is too low");
}
else if ( guess > guessNum) {
System.out.println("Your guess is too high");
}
}
System.out.println("You win!");
System.out.println("The number was " + guessNum);
System.out.println("It took you " + triesNum + " tries" );
}
}