Course Hero Logo
Question
Answered

Java Programming coding help about array A field for an int array...

Java Programming coding help about array

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.

more info in the attachment

1 Attachment
1. BIG MONEY To feed the gambling addiction we established with the slot machine exercise in Assignment 3, 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. 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.
Background image of page 1
1 page
Answer & Explanation
Verified Solved by verified expert
Rated

ur

entesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus a

Unlock full access to Course Hero

Explore over 16 million step-by-step answers from our library

Subscribe to view answer
1 Attachment
PowerBall.java
java
Recently Asked Questions
Explore recently asked questions from the same subject