public int readInteger(String prompt, int lower, int upper, int cancelResult, String cancelStr) {
		int result;
		if (_expectedIO == null) {
			result = KeyboardInput.readInteger(prompt, lower, upper, cancelResult, cancelStr);
			if (_recording) {
				_inputs.add(""+result);
			}
			return result;
		}
		while (true) {
			String input = readFromKeyboard(prompt);
			if (DEBUG) {
				System.err.println("Got input {" + input + "}");
			}
			if (input.equals(cancelStr)) {
				result = cancelResult;
				break;
			}
			try {
				result = Integer.parseInt(input);
				// If we get here, we must have a valid int
				if (result < lower || result > upper) {
					System.out.println("%%Message: `" + input + "' must be between " + 
							lower + " and " + upper + ", or '" + cancelStr + "' to cancel");
				} else {
					break;
				}
			} catch (NumberFormatException nfex) {
				System.out.println("%%Message: `" + input + "' is not a valid response.\n" +
						"Input must be an integer between '" + lower + "' and '" + upper + "'");
			}
		}
		
		if (_recording) {
			_inputs.add(""+result);
		}
		return result;
	}