Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Build an application that will receive a guess and report if your guess is the random number that was generated. Your application will narrow down
Build an application that will receive a guess and report if your guess is the random number that was generated. Your application will narrow down the choices according to your previous guesses and continue to prompt you to enter a guess until you guess correctly. Notice the user can guess at most 7 times. You will use the utility class RNG.java. Concepts covered by this assignment - A driver and a utility class - Java fundamentals, including decision structures, loops - Selection control statements - Repetition control statements - Input validation (provided in RNG.java) - Relational and logical operators - Random number generation (provided in RNG.java) Data Element Class - RNG - Provided - Do Not change this file. - This file will generate a random number between 1 and 100 - Note that the method rand () is a static method (we will learn about static methods later in the course), that means the RNG class does not need to be instantiated to use it. Call RNG. rand () to generate a random number between 0 and 99 . - You will need to use/call four methods from this class: - rand - resetCount - getCount - inputValidation - Refer to the description of each method provided in the RNG.java class. Driver Class - RandomNumberGuesser - You must create this class. - This is the driver class for RNG that contains a main method. - The driver is responsible to: - Ask the user for an initial guess of a random number between 0 and 100 . - Print out the result for that guess using the methods from the RNG class. - Allow user to give another guess between the previous low and high guesses. - Display the number of guesses after each guess. - When user guesses correctly, ask if the user wants to try another round. - Terminate the program if user has reached 7 guesses. - Refer to the program sample run for more clarification. - Data Validation. The following data is validated by the RNG method inputValidation: - Guess must be an integer between the previous low guess and high guess. - You may add any necessary methods to modularize your code. Take screenshots of runs of your program. Your runs should include feedback - on previous low and high guesses - at least one example of a guess not within the previous low and high guesses - an example of a second try with a new random number - an example of invalid number - an example of more than 7 guesses
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