|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.ObjectDice
public class Dice
This class is an implementation of a dice object, used for generating random rolls.
| Field Summary | |
|---|---|
static int |
DEFAULT_NUM_SIDES
a constant for the number of sides by default |
| Constructor Summary | |
|---|---|
Dice()
Default constructor, creates a 6-sided die The die will initially be roll to give it a side up. |
|
Dice(int sides)
Constructor, creates a die with a number of sides specified by the input parameter The die will initially be roll to give it a side up. |
|
| Method Summary | |
|---|---|
int |
getNumSides()
View the number of sides on the die |
int |
getSideUp()
show which side of the die is currently up |
int |
roll()
roll the die |
void |
setNumSides(int sides)
Change the number of sides on the die |
| 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_NUM_SIDES
| Constructor Detail |
|---|
public Dice()
public Dice(int sides)
sides - the number of sides on the die| Method Detail |
|---|
public int roll()
public void setNumSides(int sides)
sides - The new number of sides the die will havepublic int getNumSides()
public int getSideUp()
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||