Question: Write a java program that guess a number. You inputs numbers until it matched with randomly generated number. The program keeps ask a user to
Write a java program that guess a number. You inputs numbers until it matched with randomly generated number. The program keeps ask a user to input numbers between 1 to 6. Once a user input his/her guessed number, then it compares with number that is randomly generated. If it matches with randomly generated number, it display a message "Congratulation! You got it!!" and also displays how many times he/she guessed the number. Then, the program is terminated. Otherwise, the program asks a user to input another number. The output of the program should be like following:
******************
Guess a number between 1 to 6:
5
Guess a number between 1 to 6:
3
Guess a number between 1 to 6:
1
Guess a number between 1 to 6:
6
Guess a number between 1 to 6:
2
Congratulation! you got it!! you guessed it 5 times.
******************
******************
Guess a number between 1 to 6:
3
Congratulation! you got it!! you guessed it 1 times.
******************
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
