Question: I need this done in Java. Write a lottery application that simulates a lottery. The class should hava an array of five integers nammed lotteryNumbers.

I need this done in Java.

Write a lottery application that simulates a lottery. The class should hava an array of five integers nammed lotteryNumbers. The constructor should use the Random class (from tha Java API) to generate a random number in the range of 0 through 9 for each element in the array. The class should also have a method that accepts an array of five integers that represents a persons's lottery picks. The method is to comapre the corresponding elements in the two arrays and return the number of digits that match. For example, the following shows the lotteryNumbers array an the user's array with sample numbers stored in each. There are two matching digits (elements 2 and 4).

lotteryNumbers array

7 4 9 1 3

User's array:

4 2 9 7 3

In addition, the class should have a method that returns a copy of the lotteryNumbers array. Demonstrate the class in a program that utilizes GUI and asks the user to enter five numbers. The program should dispaly the numbers of the digits that matches the randomly generated lottery number. If all of the digits match, dispaly a message proclaming the user a grand prize winner. Prices are categorized as following:

0 mathces = sorry no prize

1 match = $2

2 matces =$5

3 matches = $10

4 matches = $5,000

5 matches = $50,000

The GUI should look something like this

I need this done in Java. Write a lottery application that simulates

Input/Output DOT Users Lottery Numbers: 5264 Winning Lottery Numbers: 18354 Prizes: 0 match = Sorry, no prize! 1 match =S2 2 matches = $5 Number of Matches: 3 matches = $10 1 4 matches = $5,000 5 matches =$50,000 Prize: Play Reset

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!