Question: Let's play a guessing game! Create a public class name Guesser that provides a single class method named guessValue. guessValue accepts a single Secret instance
Let's play a guessing game! Create a public class name Guesser that provides a single class method named guessValue. guessValue accepts a single Secret instance which provides a guess method that accepts an integer. If the integer is not the secret value, guess will throw an exception. Otherwise, it does not.
guessValue should return the secret value stored by the Secret instance. However, you should only guess values between and inclusive. If you guess values outside that range, the Secretinstance will break you will no longer be able to extract the secret! Also note that some Secrets will contain invalid values. If you are presented with a Secret that does not have a secret value between and inclusive, throw an assertion error. One way to do this is simply assert false. Do not use getValue. Using for loop or while method.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
