Question: Create a lottery game application. Generate three random numbers, each between 0 and 9. Allow the user to guess three numbers. Compare each of the
Create a lottery game application. Generate three random numbers, each between 0 and 9. Allow the user to guess three numbers. Compare each of the user’s guesses to the three random numbers and display a message that includes the user’s guess, the randomly determined three digits, and the amount of money the user has won, as shown in Figure 4-27.
Matching Numbers | Award ($) |
Any one matching | 10 |
Two matching | 100 |
Three matching, not in order | 1000 |
Three matching in exact order | 1,000,000 |
No matches | 0 |
Make certain that your application accommodates repeating digits. For example, if a user guesses 1, 2, and 3, and the randomly generated digits are 1, 1, and 1, do not give the user credit for three correct guesses—just one.
Step by Step Solution
3.32 Rating (164 Votes )
There are 3 Steps involved in it
Pseudocode start Declarations num randomNumber1 num randomNumber2 num randomNumber3 num guess1 num guess2 num guess3 num win num LIMIT 10 num ONEMATCH ... View full answer
Get step-by-step solutions from verified subject matter experts
