Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro SQL Server Administration

Authors: Peter Carter

1st Edition

1484207106, 9781484207109

More Books

Students also viewed these Databases questions