Question: create a new class named NumberGame. In this class, create one instance variable for storing the upper limit of the random number. Create a second

create a new class named NumberGame. In this class, create one instance variable for storing the upper limit of the random number. Create a second instance variable for storing the random number generated, and a third instance variable for the number of guesses the user has made in guessing the random number. All the instance variables must be encapsulated to receive full credit. Add a constructor to the class that takes an integer value for the upper limit and uses it to set the upper limit instance variable. This constructor will also generate the random number that the user should try to guess and set that instance variable. Finally, this constructor will initialize the instance variable for the number of guesses to 1 since the user must have at least 1 guess to play. Add get and set methods for all three instance variables. Add a method named incrementGuessCount that adds 1 to the instance variable for the number of guesses.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!