Search for question
Question

Write a program that asks a user to guess a secret number between 1 and N, where N is a positive number that the user is prompted for. The program should also prompt the user for the maximum number of guesses they would like to make. Each time the player makes a guess, the program shall respond with "correct", "too low", or "too high". The program should keep track of the number of guesses the user made to discover the secret number. The program should continue execution until the user has discovered the secret number or has exceeded the maximum number of guesses. The program shall also allow the user to play the game again until the user declines. The program should generate the magic number randomly, using the built-in Java method Math.random(). To generate a random number between 1 and N, the following formula may be used:

randomNumber = (int) ( N * Math.random() ) + 1

Submit the source code for each program, and a screen capture of each program's output, in a zip

file named as follows: Assignment3, followed by an underscore (), followed by your first name

initial, followed by your last name. For example, if your name is Jane Smith your zip file would be

Assignment3_jsmith.zip. Please be sure to comment your source code.