Question: Write a program called Lab9 that simulates a lottery. Your program will generate a 5-digit lottery number, and then it will prompt the user to

Write a program called Lab9 that simulates a lottery.

Your program will generate a 5-digit lottery number, and then it will prompt the user to enter a guess in the form of a 5-digit number. Your program should then determine how many numbers the user guessed correctly and the users prize.

Write a program called Lab9 that simulates a lottery. Your program will

generate a 5-digit lottery number, and then it will prompt the user

to enter a guess in the form of a 5-digit number. Yourprogram should then determine how many numbers the user guessed correctly and

the users prize. Lab 9: Lottery Application (Chapter 8: Programming Challenge #9

Lab 9: Lottery Application (Chapter 8: Programming Challenge #9 Write a program called Lab9 that simulates a lottery. Your program will generate a 5-digit lottery number, and then it will prompt the user to enter a guess in the form of a 5-digit number. Your program should then determine how many numbers the user guessed correctly and the user's prize. Your program must use an object of the Random class to generate five integers in the range O through 9 and must store these integers in an array Your program also needs to prompt the user to enter 5 integers in the range 0 through 9 and then needs to store these integers in an array. So you will use two integer arrays in this program. To determine how many numbers the user correctly guessed, your program needs to compare corresponding elements of both arrays in a for loop. Use a counter variable to keep track of how many numbers the user guessed correctly. At the end of the program, output to the user the lottery number, the user's guess, and the number of digits that the user guessed correctly. Finally, your program needs to determine and display the user's prize. Here is a chart that defines the prizes for this lottery: Number of correct digits Prize $0 $10 $100 2

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!