|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectPlayer
public class Player
The Player class manages a Player and her winnings.
Field Summary | |
---|---|
static int |
DEFAULT_PURSE
The default purse amount. |
Constructor Summary | |
---|---|
Player()
Constructs a new Player with the default name and purse amount. |
|
Player(java.lang.String name)
Constructs a new Player with the given name and the default purse amount. |
|
Player(java.lang.String name,
int purse)
Constructs a new Player with the given name and purse amount. |
Method Summary | |
---|---|
java.lang.String |
getName()
Gets this Player's name. |
int |
getPurse()
|
void |
transferMoneyFrom(Player loser,
int amount)
Transfers money from the losing Player to this Player. Precondition: 0 < amount < loser.getPurse() |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_PURSE
Constructor Detail |
---|
public Player()
public Player(java.lang.String name)
name
- the name of this Playerpublic Player(java.lang.String name, int purse)
name
- the name of this Playerpurse
- the amount of money in this Player's purseMethod Detail |
---|
public int getPurse()
public void transferMoneyFrom(Player loser, int amount)
loser
- the Player losing the betamount
- the amount of money to transfer from the loser to this Player.public java.lang.String getName()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |