|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--lottery.Powerball
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.
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 |
int[] white
int red
Constructor Detail |
public Powerball()
Method Detail |
public void play()
public void displayResults()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |