import cs1.Keyboard;
public class ShowInputLoop
{
public static void main (String[] args)
{
final int MIN_VAL = -10;
final int MAX_VAL = +10;
int num1;
boolean validityFlag = false;
while (!validityFlag)
{
System.out.println ("Please enter
an integer between " +
MIN_VAL + " and " + MAX_VAL + "
>");
num1 = Keyboard.readInt();
if ((num1 >= MIN_VAL) &&
(num1 <= MAX_VAL))
{
validityFlag = true;
}
else
{
System.out.println
("Out of
range input - please try again.");
}
}
System.out.println ("By George, I think you've
got it!");
System.out.println ("In a real program, we'd
continue here.");
}
}