Question
The NJ Pick Six Lottery is a game of chance where a customertries to choose six numbers (ranging from 1 to 49) that will beselected
The NJ Pick Six Lottery is a game of chance where a customertries to choose six numbers (ranging from 1 to 49) that will beselected at random. (This sort of lottery typically involves atelevised drawing using numbered ping-pong balls.) The overall goalof this assignment is to develop a Matlab code which will allow theuser to simulate a large number (say 10,000) such drawings and,assuming that the customer purchases tickets with the same numbersselected each day, determine how many 'winning tickets' thecustomer has bought. The problem has been broken up into the partsbelow. Additional information regarding the NJ Lottery can be foundusing the following sites: www.njlottery.com – Official site of theNJ Lottery https://www.lotterypost.com/results/nj - current andhistorical winning numbers and Jackpot sizeshttps://en.wikipedia.org/wiki/New_Jersey_Lottery - backgroundinformation
PROJECT OUTLINE For the project, use standard lottery rules withthe following modifications and clarifications:
1. Write Matlab code that will allow the user to input their 6chosen numbers from 1 to 49. The code should check that all numbersare appropriate (between 1 and 49), and that there are six suchnumbers with no repeats. [Hint: the sort command arranges an arrayfrom smallest to largest number, and might be useful here.]
2. Write Matlab code that will have the computer randomly select6 numbers from 1 to 49. (This can be done using the rand commandwith appropriate multiplier and floor command.) Note that these 6numbers should be integers, and again numbers should not berepeated. [Hint: one way to deal with the issue of repeatingnumbers is to choose 6 random numbers in the given range, and ifone of the numbers repeats than throw out that results andre-choose 6 random numbers until a proper one is chosen.]
3. Compare the selections of the customer with your simulatedPick Six Lottery winners. How many numbers did the customer getcorrect? Which numbers were they? After the simulation develop anoutput display which shows the customers guess, the Pick Sixresults, and the numbers which were correctly guessed.
4. Now expand upon the earlier code by developing the necessarystructure to simulate a large number (i.e. 10,000) of randomdrawings (assuming the customer will pick the same numbers eachnight). After the drawings are finished, display the number ofsimulations that were run and tabulate the success of the customer(i.e. how many of their tickets had zero correct, one correct, twocorrect, three correct, etc.) [Hint: one my computer with the coderunning properly, selecting 10k 'days' of numbers and doing thecomputations takes approximately a few seconds; 50k 'days' takes onthe order of 5 minutes. Be sure that you code works for a muchsmaller number (i.e. 5 days) before running a much largersimulation.
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