Answered step by step
Verified Expert Solution
Question
1 Approved Answer
We consider a lotto game of 42 balls numbered from 1 to 42. Each draw consists of 6 balls. A. For this game, we ask
We consider a lotto game of 42 balls numbered from 1 to 42. Each draw consists of 6 balls. A. For this game, we ask to write the method with the following header: public static int correctnumbers(int[] grid, int[] draw) This method receives: the grid chosen by a player consisting of 6 whole numbers from 1 to 42 without repetition. the corresponding draw, also consisting of 6 whole numbers from 1 to 42 without repetition corresponding to the balls in the draw. It gives as result: An integer variable corresponding to the number of correct numbers in the grid (i.e. 0, 1, 2, 3, 4, 5 or 6) for this draw. B. Now we ask to write a class (with a main method) for: Simulate a random draw of 6 balls. Simulate that a player buys 50000 grids randomly (identical grids may exist but each grid consists of 6 numbers from 1 to 42 without repetition) Your program should then output to the console as results (possibly with necessary comments): The numbers of the 6 balls of the random draw. The percentage of grids chosen without any correct number. The percentage of grids chosen with 1 correct number. The percentage of grids chosen with 2 correct numbers. The percentage of grids chosen with 3 correct numbers. The percentage of grids chosen with 4 correct numbers. The percentage of grids chosen with 5 correct numbers. The percentage of grids chosen with 6 correct numbers. Finally the complete execution time of the program from the beginning until the display results.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started