Question: Use only concepts and programming constructs / syntax we discussed in class. DON T USE THE LOOPS ( for or while ) FOR THIS ASSIGNMENT

Use only concepts and programming constructs/syntax we discussed in class.
DONT USE THE LOOPS (for or while) FOR THIS ASSIGNMENT
Problem #1(10 points)
Write a Java program (name it GuessingGameYourname) that plays guessing game with the user.
A sample game will run like follows.
The number must be a randomly generated integer number between 0 and 9 for each execution.
Give the user up to three times of guessing chance. (Do not use Loop)
For each guessing, program will reply to user Too high or Too low or Correct.
If the user succeeds in guessing at any chance, the program must skip the remaining chances. (hint:
you can use one additional boolean variable to check user guessed correctly or not)
For the last(third) guessing, program will reply to user with INCORRECT,CORRECT and let user
know the correct answer.
Welcome to the game of Guess It!
I will choose a number between 0 and 9.
You will try to guess that number. If your guess wrong, I will tell you
if you guessed too high or too low.
You have 3 tries to guess the number.
OK, I am thinking of a number. Try to guess it.
Your guess? 5// users input
Too high!
Your guess? 1// users input
Too low!
Your guess? 2// users input
Thats correct! Congratulations!
// if third guess is wrong, show incorrect message with the
correct number.
// for example, Sorry, my number is 3.
Thanks for Playing!!

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!