public class Player
extends java.lang.Object
Constructor and Description |
---|
Player()
Default constructor puts in okay defaults.
|
Player(java.lang.String name)
Default score constructor.
|
Player(java.lang.String name,
int score)
In case you need to set both, use this constructor.
|
Modifier and Type | Method and Description |
---|---|
int |
addScore(int add)
Add to the player's current score.
|
java.lang.String |
getName()
Get this player's name
|
int |
getScore()
get this player's score
|
int |
removeScore(int remove)
Remove from the player's current score.
|
void |
setName(java.lang.String name)
Set the name to something else
|
void |
setScore(int score)
Set the score to something else
|
java.lang.String |
toString()
Give a basic read out of the player's attributes
|
public Player()
public Player(java.lang.String name)
name
- Name for the playerpublic Player(java.lang.String name, int score)
name
- Name for the playerscore
- Score to be initialized topublic java.lang.String getName()
public int getScore()
public void setName(java.lang.String name)
name
- Name to be set to player's namepublic void setScore(int score)
score
- Score to be set to player's scorepublic int addScore(int add)
add
- Add amountpublic int removeScore(int remove)
remove
- Remove amountpublic java.lang.String toString()
toString
in class java.lang.Object