Write a method

public static int readInt(
      Scanner in, String prompt, String error, int min, int max)

that displays the prompt string, reads an integer, and tests whether it is between the minimum and maximum. If not, print an error message and repeat reading the input. Add the method to a class Input.

Complete the following file:

Input.java

Use the following file:

AgePrinter.java

import java.util.Scanner;

/**
   This program prints how old you'll be next year.
*/
public class AgePrinter
{
   public static void main(String[] args)
   {
      Scanner in = new Scanner(System.in);
      int age = Input.readInt(in, "Please enter your age", 
         "Illegal Input--try again", 1, 150);
      System.out.println("Next year, you'll be " + (age + 1));
   }
}