Answer to Question #334799 in Java | JSP | JSF for H123

Question #334799

Write a program that simulates a lottery. The program should have an array of five integers named lottery and should generate a random number in the range of 0 through 9 for each element in the array.

The user should enter five digits, which should be stored in an integer array named user. The program is to compare the corresponding elements in the two arrays and keep a count of the digits that match. For example, the following shows the lottery array and the user array with sample numbers stored in each. There are two matching digits (elements 2 and 4).

lottery array: 7 4 9 1 3

user array: 4 2 9 7 3


The program should display the random numbers stored in the lottery array and the number of matching digits. If all of the digits match, display a message proclaiming the user as a grand prize winner.


Input Validation: Do not accept a negative value for lottery number. Also keep track of array size.


0
Service report
It's been a while since this question is posted here. Still, the answer hasn't been got. Consider converting this question to a fully qualified assignment, and we will try to assist. Please click the link below to proceed: Submit order

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS