Class Player
java.lang.Object
edu.ntnu.idatt1002.k01g08.fta.objects.team.Player
Represents a football player.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
Returns the number of assists for this playerint
getGoals()
Returns the number of scored goals for this playergetName()
Returns the name of this playerint
Returns the squad number of this playerint
Returns the number of red cards for this playerint
Returns the number of yellow cards for this playervoid
Increments this player's number of assistsvoid
increaseAssists
(int number) Increases this player's number of assists.void
Increments this player's number of scored goalsvoid
increaseGoals
(int number) Increases this player's number of scored goals.void
Increments this player's number of red cardsvoid
increaseRedCards
(int number) Increases this player's number of red cards.void
Increments this player's number of yellow cardsvoid
increaseYellowCards
(int number) Increases this player's number of yellow cards.void
Sets the name of this playertoString()
-
Constructor Details
-
Player
Creates a player instance.- Parameters:
name
- the name of the playernumber
- the squad number of the player- Throws:
IllegalArgumentException
- if inputted name is null or blank or if inputted number is negative.NullPointerException
-
-
Method Details
-
getName
Returns the name of this player- Returns:
- the name of this player
-
setName
Sets the name of this player- Parameters:
name
- the string to set this player's name to
-
getNumber
public int getNumber()Returns the squad number of this player- Returns:
- the squad number of this player
-
getRedCards
public int getRedCards()Returns the number of red cards for this player- Returns:
- the number of red cards for this player
-
getYellowCards
public int getYellowCards()Returns the number of yellow cards for this player- Returns:
- the number of yellow cards for this player
-
getGoals
public int getGoals()Returns the number of scored goals for this player- Returns:
- the number of scored goals for this player
-
getAssists
public int getAssists()Returns the number of assists for this player- Returns:
- the number of assists for this player
-
increaseRedCards
public void increaseRedCards()Increments this player's number of red cards -
increaseRedCards
public void increaseRedCards(int number) Increases this player's number of red cards.- Parameters:
number
- the number to increase this player's red cards by
-
increaseYellowCards
public void increaseYellowCards()Increments this player's number of yellow cards -
increaseYellowCards
public void increaseYellowCards(int number) Increases this player's number of yellow cards.- Parameters:
number
- the number to increase this player's yellow cards by
-
increaseGoals
public void increaseGoals()Increments this player's number of scored goals -
increaseGoals
public void increaseGoals(int number) Increases this player's number of scored goals.- Parameters:
number
- the number to increase this player's goals by
-
increaseAssists
public void increaseAssists()Increments this player's number of assists -
increaseAssists
public void increaseAssists(int number) Increases this player's number of assists.- Parameters:
number
- the number to increase this player's assists by
-
toString
-