Question: You will be designing / implementing the completion of a Program that simulates the QuickPick function of convenience-store sold Lotto Games such as MegaMillons, Daily

You will be designing / implementing the completion of a Program that simulates the QuickPick function of convenience-store sold Lotto Games such as MegaMillons, Daily Number, Sweet Million, etc.

You will need the services of the already implemented Class called the Randomizer - specifically, the generateInt() method which has the following signature:

/**

Returns a random integer value between the values passed in as arguments high and low inclusive of.

So invoking generateInt(100, 200) might return 144 or it might return 200.

*/

int generateInt(int low, int high){ }

Review the code of the stubbed out edu.cuny.csi.csc330.lab3.SweetMillionGame.

Finish the implementation of this Class given the following requirements reviewed in class:

Needs to generate 1 or more quick pick game (one by default overridden by an optional command line argument).

For each game:

Generate 6 unique numbers between 1 and 40.

The Class is responsible for displaying the game ticket as described below (see actual example below).

The numbers for each game must be sorted in ascending order on the same horizontal line.

The Game Ticket should display a game specific heading including a date/time.

Each game will be numbered/indexed 1,2,3, N

Game numbers will be evenly spaced /formatted. And single digit numbers will be padded with a leading 0.

The Game Ticket should display both a header and trailer of your own choosing (see example ticket/output below).

Example of the output.

---------------------------------

-------- Sweet Million --------

Mon May 30 19:37:52 EDT 2016

( 1) 18 20 23 26 29 32

( 2) 10 13 25 27 30 39

( 3) 03 05 12 27 30 33

( 4) 01 06 08 17 27 31

( 5) 02 11 13 18 27 28

( 6) 09 12 19 24 29 33

( 7) 02 20 22 29 33 39

( 8) 06 11 22 23 24 40

( 9) 03 04 05 11 12 15

(10) 06 14 19 22 24 35

(11) 08 17 20 36 37 39

(12) 01 05 28 35 36 39

----- (c) S.I. Corner Deli -----

* LAB 1 - Sweetmillion Lotto QuickOicker Game

*/

package edu.cuny.csi.csc330.lab3;

import java.util.*;

import edu.cuny.csi.csc330.lib.*;

public class SweetMillionGame {

// constants specific to current game - BUT NOT ALL GAMES

public final static int DEFAULT_GAME_COUNT = 1;

private final static String GAME_NAME = "Sweet Million";

private final static int SELECTION_POOL_SIZE = 40;

private final static int SELECTION_COUNT = 6;

private Randomizer randomizer;

public SweetMillionGame() {

init(DEFAULT_GAME_COUNT);

}

public SweetMillionGame(int games) {

init(games);

}

private void init(int games) {

randomizer = new Randomizer();

/**

*

* Now what ... START FROM HERE

* What additional methods do you need?

* What additional data properties/members do you need?

*/

}

/**

*

*/

public void displayTicket() {

/**

* display heading

*

* for i in gameCount

* generate selectionCount number of unique random selections in ascending order

*

* display footer

*/

// display ticket heading

displayHeading();

/**

* Display selected numbers

*/

// display ticket footer

displayFooter();

return;

}

protected void displayHeading() {

}

protected void displayFooter() {

}

/**

* @param args

*/

public static void main(String[] args) {

// takes an optional command line parameter specifying number of QP games to be generated

// By default, generate 1

int numberOfGames = 1;

if(args.length > 0) {

numberOfGames = Integer.parseInt(args[0]);

}

SweetMillionGame game = new SweetMillionGame(numberOfGames);

// now what

game.displayTicket();

System.out.println("Leaving ...");

}

}

Please finish the coding as the assignment is required. Thank you

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!