|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--NumberPicker
This class is the number picker It picks a random number between the min, and max fields (inclusive) and will let you know if you guess the right number.
Field Summary | |
static int |
DEFAULT_MAX
The default maximum value |
static int |
DEFAULT_MIN
The default minimum value |
static long |
DEFAULT_SEED
The default seed is based on the current time |
Constructor Summary | |
NumberPicker()
Constructor that takes no arguments. |
|
NumberPicker(int min,
int max,
long seed)
Constructor that takes the min, max, and seed |
|
NumberPicker(long seed)
Constructor that takes a seed for the random number generator |
Method Summary | |
int |
getMax()
Method to get the maximum value that can be picked |
int |
getMin()
Method to get the minimum value that can be picked |
boolean |
isCorrect(int guess)
Check if the given guess is equal to the picked number |
void |
pickANumber()
Method to pick a random number between the min and max field values (inclusive) |
void |
setMax(int value)
Method to set the maximum value |
void |
setMin(int value)
Method to set the minimum value |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int DEFAULT_MIN
public static final int DEFAULT_MAX
public static final long DEFAULT_SEED
Constructor Detail |
public NumberPicker()
public NumberPicker(long seed)
seed
- the seed for the random number generatorpublic NumberPicker(int min, int max, long seed)
min
- the min to usemax
- the max to useseed
- the seed for the random number generatorMethod Detail |
public int getMin()
public int getMax()
public void setMin(int value)
value
- the new minimum to usepublic void setMax(int value)
value
- the new maximum to usepublic void pickANumber()
public boolean isCorrect(int guess)
guess
- the guessed number
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |