/** * Class MysterySearchDriver, providing main for MysterySearch problem on HW1 * BU CAS CS 112 Fall 2011 by Leo Reyzin */ import java.util.Scanner; public class MysterySearchDriver { public static void main (String[] args) { Scanner scan = new Scanner (System.in); int inputValue, guessedValue; MysteryInt mystery = new MysteryInt(); for (;;) { inputValue = scan.nextInt(); if (inputValue < MysteryInt.MIN_VALUE || inputValue > MysteryInt.MAX_VALUE) break; mystery.setValue (inputValue); guessedValue = Guesser.guess (mystery); if (guessedValue != inputValue) System.out.println("Incorrect guess, "+guessedValue); else System.out.println("Ok"); } } }