Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program using JAVA and named GuessingGame Using a random numner generator, a while loop and a sentineal value. Guess a number between 1-20.

Write a program using JAVA and named GuessingGame

Using a random numner generator, a while loop and a sentineal value. Guess a number between 1-20.

Write a program that generates a random number and asks the user to guess what the number is. If the users guess is higher than the random number, the program should display That is too high Guess again. If the users guess is lower than the random number, the program should display That is too low Guess again. If the user guesses correctly, Congrats! You nailed it!, is displayed to the user. The program should use a loop that repeats until the user correctly guesses the random number.

Keep track of the number of guesses that the user makes.

Include a sentinel value (of -1), so that the user may exit from the guessing game at any time.

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 Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

9th Edition

0135188148, 978-0135188149, 9781642087611

More Books

Students also viewed these Databases questions

Question

What are Decision Trees?

Answered: 1 week ago

Question

What is meant by the Term Glass Ceiling?

Answered: 1 week ago