Question: Exercise 2 Write a java program that to help the Lebanese scout to create an online tombola ( lottery ) . Your program should generate

Exercise 2
Write a java program that to help the Lebanese scout to create an online tombola (lottery). Your program should generate a random number between 100 and 999 using Math.random(). Your program should then ask the user to enter 3 numbers (0 to 9) and then compare the numbers entered with the randomly generated number. If the 3 numbers match the generated 3 digits number in the same order, your program outputs "Congratulations, You won the tombola". The user is allowed to repeat his guess for 10 times maximum,
Sample run1:
Enter 3 digits 165
You can try for 9 times
Enter 3 digits 359
You can try for 8 times
Enter 3 digits 163
You can try for 7 times
Enter 3 digits 916
Congratulations, You Won !!!
Sample run2:
Enter 3 digits 198
You can try for 9 times
Enter 3 digits 129
You can try for 8 times
Enter 3 digits 268
You can try for 7 times
Enter 3 digits 168
You can try for 6 times
Enter 3 digits 169
You can try for 5 times
Enter 3 digits 122
You can try for 4 times
Enter 3 digits 198
You can try for 3 times
Enter 3 digits 136
You can try for 2 times
Enter 3 digits 901
You can try for 1 times
Enter 3 digits 987
You can try for 0 times
Exercise 2 Write a java program that to help the

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 Programming Questions!