// ****************************************************************
//   Guess.java
//
//   Play a game where the user guesses a number from 1 to 100
//          
// ****************************************************************
import java.util.Scanner;

public class Guess
{
    public static void main(String[] args)
    {
      int numToGuess;       //Number the user tries to guess
      int guess;            //The user's guess

      Scanner scan = new Scanner(System.in);
 
      // add code below each comment to carry out the action listed in the comment
      // more than one statement may be needed in some cases

      //randomly generate the  number to guess - use Math.random()

      //print message asking user to enter a guess

      //read in guess
                
      while (  )  //keep going as long as the guess is wrong
      {
        //print message saying guess is wrong
        
        //get another guess from the user
        
      }

      //print message saying guess is right
      
    }
}

@@ -269,17 +269,17 @@
 ss Guess
-%0A
+ 
 %7B%0A    pu
@@ -314,20 +314,16 @@
 %5B%5D args)
-%0A   
  %7B%0A     
@@ -347,16 +347,17 @@
       //
+ 
 Number t
@@ -409,16 +409,17 @@
       //
+ 
 The user
@@ -422,24 +422,189 @@
 user's guess
+%0A      int guessesTaken = 0; // The user's total number of guesses%0A      int snapshotGuess;  // Temporary integer used to remember the guess taken before changing it
 %0A%0A      Scan
@@ -856,334 +856,1643 @@
 m()%0A
-%0A      //print message asking user to enter a guess%0A%0A      //read in guess%0A                %0A      while (  )  //keep going as long as the guess is wrong%0A      %7B%0A        //print message saying guess is wrong%0A        %0A        //get another guess from the user%0A        %0A      %7D%0A%0A      //print message saying guess is right%0A      
+      numToGuess = (int) ((Math.random() * 100) + 1);%0A%0A      //print message asking user to enter a guess%0A      System.out.println(%22What number am I thinking of between 1 and 100?%22);%0A%0A      //read in guess%0A      guess = scan.nextInt();%0A      guessesTaken++;%0A                %0A      while (numToGuess != guess) %7B%0A        while (guess %3C 0 %7C%7C guess %3E 100) %7B%0A          System.out.println(%22What? That's not even a valid answer!%22);%0A          System.out.println(%22Give me a valid guess...%22);%0A          guess = scan.nextInt();%0A          guessesTaken++;%0A        %7D%0A%0A        System.out.println(%22Nope, that's not it. Try again.%22);%0A        snapshotGuess = guess;%0A        %0A        if (guess %3E numToGuess) %7B%0A          System.out.println(%22Your guess was a bit high.%22);%0A          System.out.println(%22Guess again.%22);%0A          guess = scan.nextInt();%0A          guessesTaken++;%0A          while (guess %3E snapshotGuess) %7B%0A            System.out.println(%22You were too high! Why are you going higher? Try again.%22);%0A            guess = scan.nextInt();%0A            guessesTaken++;%0A          %7D%0A        %7D else %7B%0A          System.out.println(%22Your guess was a bit low.%22);%0A          System.out.println(%22Guess again.%22);%0A          guess = scan.nextInt();%0A          guessesTaken++;%0A          while (snapshotGuess %3E guess) %7B%0A            System.out.println(%22You were too low, and you're going lower...? Try again.%22);%0A            guess = scan.nextInt();%0A            guessesTaken++;%0A          %7D%0A        %7D%0A      %7D%0A%0A      //print message saying guess is right%0A      System.out.println(%22You're good.%22);%0A      System.out.println(%22It only took you %22 + guessesTaken + %22 times!%22);
 %0A   

Complete guessing game