
public class loopDemo4 {
	
	public static void main(String[] args) {
		// Required variables:
		// int 		- (our guess number)
		// String	- to hold the user's response of "yes" or "no"
		int guess = 0;
		String response="no";
		
		// ask the user for bounds on their 'secret' number
		System.out.println("What's an integer number lower than your secret number? ");
		int lower = Keyboard.readInt();
		System.out.println("What's an integer number higher than your secret number? ");
		int higher = Keyboard.readInt();
		
		
		// Required code:
		// loop		- continually updating the guess number
		//			  and asking user if that number is correct
		for(int i=lower; i<=higher; i=i+1){
			System.out.println("Is you number "+i+" (yes/no)? ");
			response = Keyboard.readString();
			
			if(response.equals("yes"))
				guess = i;
		}
		
		// response to user indicating when we've found their number
		System.out.println("Your number was "+guess);
	}
	
}


