/*   getValueFromInput
 *   Takes as input a String to print to the monitor
 *   Reads characters from the keyboard
 *   Loops until an integer is found
 */    

    public int getValueFromInput(String msg) {

	int num = -1;
	try {

	    String inputLine;
            InputStreamReader isr = new InputStreamReader(System.in);
            BufferedReader keyboard = new BufferedReader(isr);
   	    System.out.print(msg);
	    while ((inputLine = keyboard.readLine()) != null) {
		try {
		    // System.out.println(inputLine);
		    num =  Integer.parseInt(inputLine);
		    return num;
		} catch (NumberFormatException e) {
		    System.out.println("Enter an integer!");
		    System.out.print(msg);
		}
	    }
	} catch (IOException ioe) {
	    System.out.println("Problem reading input");
	    
	}
	return num;

    }
