Alright, I am making a HiLo game and I found an issue with the code. The player starts with 1000 points but they can place a bet higher than the number of points they have. I want it so they can not bet more than what they have
int playerPoints = 1000;
int betPoints;
int predict;
int randomNumber;
System.out.println("Enter the points you want to risk");
betPoints = input.nextInt();
I need betPoints to be less than or equal to playerPoints. How can I restrict the integer to obey that?
whileloop), add an if statement to check for validity, and then display an error and recollect if necessary. BTW, you also need to ensure they do not enter, presumably<=0.