CSC-111 HW9 Lucky for Life Lottery Number Generator with Solution

Due: Saturday, Dec 1, 11:59pm


Write an application to help choose the Lucky for Life lottery numbers.

The Lucky Numbers follow these rules:

  • Pick a group of 5 numbers from the numbers 1 to 43, inclusive (NO DUPLICATES!)
  • Pick 1 number (the LUCKY BALL number) out of the numbers 1 to 43.  This one number can duplicate one of the 5 already picked above.  This Lucky Ball number is totally independent of the group of 5 picked above.

Your application should print the message “Your Lucky For Life Cash numbers are: ” followed by 5 random numbers in the range 1-43. These 5 numbers must be sorted. Also, remember: THERE ARE NO DUPLICATES IN THESE 5.  ALSO, this group of 5 numbers must be sorted on output!  Then on a separate line print: “Your Lucky Ball Number is: ” followed by the lucky ball number.

Make sure your generator program keeps generating these numbers by asking the user if they would like to run the generator again.  Use the Project Template.  In fact, use this template for all future assignments as well.

Your grade will be based on the following criteria:

  • if you coded methods
  • the number of methods
  • if you formatted the output values using the printf method
  • if you followed instructions
  • if the output is correct.
  • if you followed, Java identifier naming conventions

Happy Computing!