Re-enter information question
Hi guys,
I'm using BlueJ, doing a small project for College.
The project involves getting the user to enter information, do some calculations inside Java and showing the results a number of ways.
My problem is this:
How do I code it so that incorrect information needs to be reentered?
For example- If the user enters a grade of 110, it must be between 0-100 so how do I make it go back to reentering?
(Awkward wording :frusty:)
Here's my current code:
System.out.print("Critical Thinking grade: ");
opGrade=sc.nextInt();
if(opGrade<0 || opGrade >100)
{
System.out.println("Please reenter the number");
System.out.println();
System.out.print("Critical Thinking grade: ");
stuNumber=sc.nextInt();
}
Using this way works, except if the wrong number is entered again, it just skips to the next question.
Kelp? :s:
Re: Re-enter information question