Question: You are going to create a program that generates SuperLotto lottery numbers. Create a class called SuperLottoPlus.java Create a method called generateNumbers that returns an
You are going to create a program that generates SuperLotto lottery numbers.
Create a class called SuperLottoPlus.java
Create a method called generateNumbers that returns an String containing 6 random SuperLotto lottery numbers
Method must have correct method signature [10 pt]
The first 5 numbers must be random numbers from the range 1 to 47, and the 6th number (the MEGA) must be from 1 to 27. [10 pt]
Method returns a String of lotto numbers in the format: N N N N N (MEGA: N). For example, 47 22 25 4 13 (MEGA: 14) [20 pt]
There should be NO duplicates numbers in the first 5 numbers. You can write helper methods to achieve this. It is fine for the mega numberto be a duplicate. [20 pt]
In the main method
Ask the user how many lotto tickets they want, and store that number as a variable [10 pt]
If the user enters 5, for example, then use a looping structure to loop 5 times. [10 pt]
In each loop iteration, call the generateNumbers method and print out the numbers to the screen [10 pt]
Add Javadoc style comments to your class, and all your methods. [10 pt]
Hint:
Use the Random class to create random numbers
Example output: How many Super Lotto tickets do you want? 4 28 8 11 9 28 MEGA (4) 38 39 29 47 27 MEGA (27) 15 17 33 12 6 MEGA (19) 30 29 18 20 31 MEGA (12)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
