Powerball lottery program

$25.00

Category: You will Instantly receive a download link for .zip solution file upon Payment || To Order Original Work Click Custom Order?

Description

5/5 - (2 votes)

Write a program that simulates the Powerball lottery.
Create a PowerBall class that contains:
– A field for an int array of size 6.
– A constructor that initializes this array with 6 random values (0-9).
– A method called checkMatch that takes as an argument an int array and returns how many numbers match the class’s int array. To match, the same numbers must be in the same position.

Write a main class which asks to user to enter 6 numbers as their lottery ticket and store it in an array. Then create a PowerBall object and give the user’s ticket to the checkMatch method. Then figure out the amount won based on the return value.

The winnings are determined as follows:
If 0 numbers match, no winnings
If 1 number matches, win $4
If 2 numbers match, win $7
If 3 numbers match, win $100
If 4 numbers match, win $10,000
If 5 numbers match, win $1 Million
If all 6 numbers match, win Grand Prize of $450 Million

Output the user’s lottery ticket, the powerball numbers, how many matched, and the amount of money won. (JAVA PROGRAM HELP)