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 patron’s 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 year’s worth of computer-generated picks.

2) For each lottery drawing (one for each Wednesday and Saturday drawing for 52 weeks) 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 your pick, display the year’s worth of picks along with the following counts. Count the number of occurrences of each of the patron’s numbers during the year. For example, it the patron's picks are 1 3 35 4 12 6, your program should print the number of times the computer chose a 1, how many 12s etc. Also, if the patron wins the jackpot, display an appropriate message beside the winning set of numbers as well as reporting the total count of jackpots won (if none, report 0 jackpots) during the year. Note that only exact matches of the original 6 numbers qualify for the Jackpot (order does not matter); the bonus number is not included for this prize.

4) You must use an application-style program (not an applet), Math.random for random number generation, and java.util.ArrayList<E> to “hold” and manipulate most of your data. Your ArrayList needs to specify an appropriate data type for E. You must also use one "regular" array for use as counters (holding ints).

5) Your program must reflect a modular design using multiple methods. Each method needs to be commented.

So post some code and ask specific questions.

Show a little effort on your homework if you want anyone to offer any assistance.

This article has been dead for over six months. Start a new discussion instead.