lottery
Class Powerball

java.lang.Object
  |
  +--lottery.Powerball

public class Powerball
extends java.lang.Object

The Powerball class simulates the Powerball lottery. In the Powerball lottery, five white balls are chosen at random ranging from 1 to 49, one red ball (known as the power ball) is chosen at random ranging from 1 to 42.

Version:
1.0
Author:
Rich Raposa

Field Summary
(package private)  int red
          Represents the red power ball chosen.
(package private)  int[] white
          An array that contains the five white balls chosen.
 
Constructor Summary
Powerball()
          Constucts a Powerball object by initializing the white field to a new array of 5 ints.
 
Method Summary
 void displayResults()
          Prints out the results of the play() method.
 void play()
          Generates five random, unique numbers to simulate the five white balls selected, and generates a random number between 1 and 42 to represent the selected red ball.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

white

int[] white
An array that contains the five white balls chosen.


red

int red
Represents the red power ball chosen.

Constructor Detail

Powerball

public Powerball()
Constucts a Powerball object by initializing the white field to a new array of 5 ints.

Method Detail

play

public void play()
Generates five random, unique numbers to simulate the five white balls selected, and generates a random number between 1 and 42 to represent the selected red ball.


displayResults

public void displayResults()
Prints out the results of the play() method.