Question
Java Guessing Game Class The class will generate a random number of 1 to 15, and then check to see if the user guessed the
Java Guessing Game Class
The class will generate a random number of 1 to 15, and then check to see if the user guessed the number correctly. If the number is incorrect, the user should have the chance to guess again, until they guess the right number or they guess 10 times. The class method should keep track of the number of guesses the user has had, and return this value.
The class should have one constructors, a default and a defined. The class should have a method to calculate the random number. It should also have a method to check the guess to see if it was correct. The guessing method should return a Boolean value to determine if the user keeps guessing.
The program should check for valid input. It should print out either that the users guess was incorrect, printing out the value the user last guessed and how many guesses it took; or that the guess was correct, printing out how many guesses it took to get the correct answer.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started