Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a Java class Guess.java with instance variables, secretNumber(an int), wh

ID: 3629342 • Letter: C

Question

Create a Java class Guess.java with instance variables, secretNumber(an int), which is the number the user is trying to guess, guessLimit(int), which is maximum number of guesses, and numGuesses(int). Use get and set methods for both instance variables as well as userGuess method that takes as an argument a user's guess for the secret number, and prints out if it is too high or too low. Then create a tester class called GuessTester.java which tests Guess.java. This class should construct a Guess object and set a secret number that is fixed in the value at the beginning. guessLimit should be equal to 4, and the Scanner class should be used to retrieve guesses from the user. The program should keep looping until a correct secret number is guessed. The output should say too high or too low depending on the guess, and if guessed it should say the number of guesses that it took. Also, if 4 guesses are used it should say you lose.

Explanation / Answer

}

}