Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java Hi, I'm making a Lottery simulator and really need help as I am VERY new to java. We are supposed to use Arrays and

Java

Hi, I'm making a Lottery simulator and really need help as I am VERY new to java. We are supposed to use Arrays and Array Lists Hi, I would like to make a Java lottery simulator. This one is different than most, however. The program requirements are:

1) The patron enters 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 patrons numbers throughout this simulation. It is as if the patron plays the same numbers every week (Jack tells us that this is a common occurrence). We will be testing this set of numbers against a years worth of computer-generated picks.

2) For each lottery drawing (52 weeks with 2 drawings a week) in your simulation, the computer must randomly pick and display an initial 6 numbers followed by a 7th number, called the bonus number. The possible random numbers (integers) are 1 through 42. You may not have duplicates!

3) Test the lottery drawing numbers against the patron's choices for the prize winnings, cumalative frequencies(Showing how many times each of the paterons choices were drawn throughout the year) and display each of the lottery drawings for a year along with the cumlative frequency of jackpot winnings. For example if the patrons's choice are 1-35-3-4-12-6 and the drawings are 12-3-4-35-1-6 and a bonus of 18 the program should print the lottery drawings (including the bonus number) along with a message that the patron won 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 computers chocies match (frequency of 1's,2's,etc) At the end of the year report the total count of jackpots won (if none report 0) along with the frequencies for each of the patron's chosen numbers

4.) Use two classes a driver and tester and a lottery drawing data type. The driver and tester class get the patrons choices,loops through a years 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 instaniated, storing the numbers in private ArrayList. Class data should also include a private static array of ints as frequencies counting the occurrences of (at least) the patron's choices, and private static counters for the number of jackpots 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 overrride the toString method to print the ArrayList and identify the bonus number. Be sure that the bonus number can be viewed and tested seperatly from the first 6 numbers since its not included in the big jackpot winnings.

5.) Use Math.random for all number generation, and use an ArrayList for both the lottery drawings and patrons choices. Your ArrayList needs to specify an apporpriate data type. You must also use one "regular" array (holding its) to accumulate/count frequencies of the patron's numbers throughout the year. It must reflect a modular design using multiple methods

6.) Allow the patron to choose to have the computer pick the patrons numbers to simulate the patrons EasyPick option. Display These number and use them as said. (Avoid duplicates)

THANK YOU!

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

Practical Issues In Database Management A Refernce For The Thinking Practitioner

Authors: Fabian Pascal

1st Edition

0201485559, 978-0201485554

More Books

Students also viewed these Databases questions