Question: Java Eclipse: The winning numbers for a lottery are stored in an array and info of 5 peoples lottery choices are each stored in an

Java Eclipse:

The winning numbers for a lottery are stored in an array and info of 5 people’s lottery choices are each stored in an array.

Your method should compare incoming array’s elements against the winning combo order of numbers and return how many numbers match between the two.

int[] winCombo = {74,89,13, 25, 46} //only this array is known to the method.

Main method should call the above method with each array and print the results.

// Assume these values are available to you – you need not get user input.

//the following 5 arrays are known to main method only.

int[] Person1 = {11,25,35,25, 46}

int[] Person2 = {89,25,13,25,46}

int[] Person3 = {74,89,13,25,46}

int[] Person4 = {89,74,25,46,13}

int[] Person5 = {11,22,33,44,55}

For above sample input, expected output would be :

winning combo : 74,89,13,25,46

Person1’s choice : 11,25,35,25,46 - your match is 2

Person2’s choice : 89,25,13,25,46 - your match is 3

Person3’s choice : 74,89,13,25,46 - your match is 5 - hooray ! you win

Person4’s choice : 89,74,25,46,13 - your match is 0

Person5’s choice : 11,22,33,44,55 - your match is 0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The java program that test the method checkMatch that finds the number of matches of user lottery with the winning combo array The program is tested w... View full answer

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 Accounting Questions!