ok my method asks to the user to enter a lower boundary and an upper boundary. If their upper boundary number is lower than the lower boundary number then it need to print out something like "Your upper boundary cannot be smaller than your lower boundary" and then start asking for new numbers again. Im guessing some kind of loop but im not sure how to set it up. Heres what i have in the method so far.
Code:
public void getBoundaries(); // get lower and upper boundaries
{
Scanner in = new Scanner ( System.in );
int value = 0, value1 = 0;
do
{
System.out.print ( "Please enter the lower boundary (between 1 and 50000): " );
value = in.nextInt();
}
while ( ( value < 1 ) || ( value > 50000 ) );
do
{
System.out.print ( "Please enter the upper boundary (between 1 and 50000): " );
value = in.nextInt();
}
while ( ( value1 < 1 ) || ( value1 > 50000 ) );
}
Comment