Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Megabucks Lottery Program Due Date: At the urging of Mr. Jackpot Jack, the Tri-State Megabucks home office wants to continue to Mr. Jack thinks that

image text in transcribed
image text in transcribed
Megabucks Lottery Program Due Date: At the urging of Mr. Jackpot Jack, the Tri-State Megabucks home office wants to continue to Mr. Jack thinks that randomly picking ping-pong balls from a basket looks too old-fashioned. So, they are considering using a computer to pick the winning numbers at each drawing. Since they were told that the numbers picked by the computer are pseudo-random, they want you to write a program that picks and tests a year's worth of lottery numbers to check the results. All entries for submitting this program are subject to the deadlines set by Jackpot and his underlings. The program's functionality and requirements are: 1) The patron will enter his/her 6 chosen numbers (from the numbers 1 through 42 without duplicates) on the keyboard at the appropriate prompt(s). This same, single set of numbers will be used as the patron's numbers throughout the simulation (it is as if the patron plays the same numbers every week as Jack tells us this is a common occurrence). We will e testing this set of numbers against a year's worth of computer generated lottery drawings. 2) For each lottery drawing (52 weeks with 2 drawing a week: Wed. & Sat.) in your simulation, the program randomly picks and displays an initial 6 numbers, followed by the bonus number which is a 7h randomly chosen number. The possible random numbers are the integers 1 through 42. You may not have duplicates among the 7 randomly chosen numbers for a lottery drawing! When printed, the 7h number should be identified as being the bonus number. ArrayLIS 3) Test the lottery drawing numbers against the patron's choices for prize winnings, cumalative frequencies (showing how many times each of the patron's choices were drawn throughout the year), and display each of the lottery drawings for a year along with the cumulative frequency of jackpot winnings. For example, it the patron's choices are 1-3-35-4-12-6, and your lottery drawing is 12-3-4-35-1-6 and bonus of 18, your program should print the lottery drawing (including the bonus number) along with a message that the patron won the Jackpot! Note that only exact matches of the original 6 numbers quality for the Jackpot (order does not matter); the bonus number is not included for the Jackpot prize. The count of the number of jackpots should be incremented along with the number of times the computer's choices match (frequency of the 1's, 2's, etc.) At the end of the year," report the total count o jackpots won (if none, report O jackpots) along with the frequencies for each of the patron's chosen numbers 4) Use two classes: a driver/tester and a lottery drawing data type. The driver/tester class gets the patrons choices, loops through a year's worth of lottery drawings and prints the resulting statistics. The lottery drawing class should have a constructor that creates the random lottery drawing (without duplicates) when the class is instantiated, storing the numbers in a private ArrayList. Class data should also include a private static array of ins as frequencies counting the occurrences of (at least) the patron's choices, and private static counter(s) for the number of Jackpots/prizes won. Among the methods for the lottery drawing class include: a method to update the frequencies, a method test for winnings, static method(s) to print the static data that records the frequencies and winnings, and override the toString method to print the ArrayList and identify the bonus number. Be sure that the bonus number can be viewed and tested separately from the first 6 numbers since it's not included in the big jackpot winnings 5) Use Math.random for all random number generation, and an ArrayList for both the lottery drawings and patron choices. Your ArrayList needs to specity an appropriate data type. You must also use one "regular array (holding ints) to accumulate/count the frequencies of the patron's numbers throughout the year. Your work must reflect a modular design using multiple methods. Each method needs to be commented Project extensions are on the next page

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems For Advanced Applications 15th International Conference Dasfaa 2010 International Workshops Gdm Benchmarx Mcis Snsmw Diew Udm Tsukuba Japan April 2010 Revised Selected Papers Lncs 6193

Authors: Masatoshi Yoshikawa ,Xiaofeng Meng ,Takayuki Yumoto ,Qiang Ma ,Lifeng Sun ,Chiemi Watanabe

2010th Edition

3642145884, 978-3642145889

More Books

Students also viewed these Databases questions