/** * This method obtains an integer (positive or negative whole number) from the user. * * @param prompt * A message for the user, so they know what number is expected * @param lowerLimit * the lowest number that the user can enter * * @return An int containing the number entered by the user. If the user tries to enter something a number * outside of the limits, they are re-prompted until they provide the appropriate input */ public static int readIntGreaterThan(String prompt, int lowerLimit) { int result; do { result = Console.readInt(prompt + " (must be greater than " + lowerLimit + ")"); } while (result < lowerLimit); return result; }