Question: In java Create a number guessing game with a twist! Prompt the user to enter a % chance for the following ranges: 1-100, 101-200, 201

In java

Create a number guessing game with a twist!

Prompt the user to enter a % chance for the following ranges: 1-100, 101-200, 201 - 300, 301-400, 401-500, 501-600, 601-700, 701 -800, 801-900, 901-1000

Based on these percentages, have the program select a random number between 1-1000. (Example: If there is a 25% chance for 201-300, there should be a 25% weighted chance for the program to select a number between 201-300)

Prompt the user to then make ONE guess between 1-1000.

If the number is within 150 of the randomly selected target number, Print "Good guess!"

If the number is over 151 but under 300 away, Print "Keep trying!"

If the number is over 301 away, print "You should stop"

Display the randomly generated key number, the difference between the key number and the user guess, and ask the user if they would like to play again or quit.

Generate a new random number after each guess the user makes.

BONUS: Make 1000 loop back around to 1 so that for example, number 5 would only be 15 away from 990.

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!