import java.util.*;
public class Main
{
public static int getInt(String text, int low, int high)
{
int answer;
do
{
System.out.print(text);
answer = Integer.parseInt(new Scanner(System.in).nextLine());
if ((answer > high))
{
System.out.println("Not a valid answer. Must be no more than 150");
}
if ((answer < low))
{
System.out.println("Not a valid answer. Must be no less than 0");
}
} while ((answer < low) || (answer > high));
return answer;
}
public static void main(String[] args)
{
int age = getInt("Enter your age: ", 0, 150);
System.out.printf("The age is %1$s" + "\r\n", age);
}
}