a modified guessNumber.java Demo function