Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I'm confused on how to limit the time of tries. Am I going to have a for loop? Can you show me the code??? Appreciated!

image text in transcribed

I'm confused on how to limit the time of tries. Am I going to have a for loop? Can you show me the code??? Appreciated!

GuessingGame.java) Write a program that generates a random number and asks the user to guess what the number is. If the user's guess is incorrect, the program should display "too high, try again" or "too low, try again" Repeat until the user has guessed correctly or exceeded the number of attempts. The program should issue a final message indicating the number was guessed and the number of attempts it took, or the number that was not guessed 1. This program will run at the command prompt (using System.out.println and Scanner) The upper limit of number to be guessed and the max number of guesses should be constant values. I should be able to change those two constants and the rest of the program will operate properly (including output statements) In my example, the max number of guesses is 5, the high value is 100. No use of methods others than main) required Sample program run #1: I'm thinking of a number between 1 and 100 You have 5 tries to guess it Guess 1: 50 Sorry, that's too high. Guess again: 25 No, that's too low Guess again: 35 No, that's too low Guess again: 40 No, that's too low Guess again: 45 You are out of guesses. I was thinking of the number 49

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

Database Basics Computer EngineeringInformation Warehouse Basics From Science

Authors: Odiljon Jakbarov ,Anvarkhan Majidov

1st Edition

620675183X, 978-6206751830

More Books

Students also viewed these Databases questions

Question

=+3. How is dopamine thought to be involved in schizophrenia?

Answered: 1 week ago

Question

Which form of proof do you find most persuasive? Why?

Answered: 1 week ago