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
Enjoy 24/7 customer support for any queries or concerns you have.
Phone: +1 213 3772458
Email: support@gradeessays.com