Question: Subject: java Q2. (5 marks) Write a program that will generate a random integer number in the range (1-50), then will ask the user to
Subject: java
Q2. (5 marks)
Write a program that will generate a random integer number in the range (1-50), then will ask the user to guess this random number, the user will have up to 7 tries, if the user guess is lower than the random number print Too low, if the guess is higher print Too high, if he gets it correctly print You found it then exit the loop. If he fails to guess it in the 7 tries print Sorry you lost!.
Note : you should keep asking for the user guess if he doesnt answer correctly in 7 tries, but if he enters the right guess then you should exit the loop immediately.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
