Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hello, I need help with this RANDOM Guess the Number Game. I was not in line with the instructors instructions, so he did not accept.

Hello, I need help with this RANDOM Guess the Number Game. I was not in line with the instructors instructions, so he did not accept. Need help adjusting the code. My Code and Assignment Instructions are below.

image text in transcribed

image text in transcribed

image text in transcribed

package guessthenumbergame; import java.util. Random; import java.util. Scanner; public class GuessTheNumberGame \& public static void main(String[] args) \& Random rand =new Random(); Scanner scanner = new Scanner (source: System. in); int randomnumber = rand. nextInt ( bound : 100)+1; //System.out.println ("Random number is " + randomNumber): boolean incorrectAnswer = true; Unit 5 Assignment - Option 1 Write a program that generates a random integer between 1 and 10 . Tell the user the number and ask him/her if they think the next number will be higher or lower. Record the user's response and generate a new number between 1 and 10 . Tell the user if he/she was right or wrong. Put your program in a loop that runs until the user gets 10 correct answers. How to get started: - See if you can generate a random number between 1 and 10 and print it to the screen. Run the program a few times and see if you're getting the right numbers. - Prompt the user to guess if the next number is higher or lower. - Generate the next number and print it to the screen. - Write an if else statement that determines if the user was correct or not. Tell the user the result. - Add a variable in your program that keeps track of the number of correct responses. This variable should be initialized to 0 . - Increment your variable when user gets an answer correct. - Put your code in a loop that continuously runs your code until the number of correct responses is 10. Extra Credit At the beginning of the program, ask the user for the range he/she would like to use for the random numbers (instead of 1-10)

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

More Books

Students also viewed these Databases questions

Question

5-8 What are the advantages and disadvantages of the BYOD movement?

Answered: 1 week ago