You are going to create a program that generates Superlotto lottery numbers.
• Create a class called super LottoPlus. java
• Create a method called generateNumbers that returns an String containing 6 random Superlotto lottery numbers
o Must have correct method signature, and return a String of lotto numbers.
o The String should be in this format: N N N N N (MEGA• N). For example, 47 22 25 4 13 (MEGA 14)
o The first 5 numbers must be from the range 1 to 47, and the 6th number (the MEGA) must be from 1 to 27.)
• In the main method
o Ask the user how many lotto tickets they want, and store that number as a variable
o If the user enters 5, for example, then use a looping structure to loop 5 times.
o In each loop iteration, call the generateNumbers method and print out the numbers to the screen

• Hint:
o int number = (int) (10 * Math. random ()) + 1; //gives you a random number from 1 to 10.
o You can also create the random numbers by creating an object of the Ran dom class.

Example output:
How many Super Lotto tickets do you want?
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)

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

import java.util.Scanner;

public class SuperLottoPlus {

// Method generateNumbers
// returns a String containing 6 random SuperLotto lottery numbers
public static String generateNumbers() {
    int number;
    String result = "";
    // Generate 6 random numbers from 1 to 47 inclusive
    for (int i = 0; i < 6; i++) {
      number = (int) (47 * Math.random()) + 1;
      result += String.valueOf(number) + " ";...

By purchasing this solution you'll be able to access the following files:

for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Java Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Upload a file
Continue without uploading

We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats