diff --git a/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/Player.java b/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/Player.java
index 0d5939d..9186f09 100644
--- a/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/Player.java
+++ b/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/Player.java
@@ -2,79 +2,122 @@
import java.math.BigDecimal;
-public class Player {
+/**
+ * Represents a player in the system.
+ *
+ *
Each player:
+ *
+ * - Has a portfolio
+ * - Can buy and sell shares on an {@link Exchange}
+ * - Has a set amount of money to use on said exchange.
+ * - Has a {@link TransactionArchive}
+ *
+ * */
+public final class Player {
- private final String name;
- private final BigDecimal startingMoney;
- private BigDecimal money;
- private final Portfolio portfolio;
- private final TransactionArchive transactionArchive;
+ /**
+ * Name of player.
+ * */
+ private final String name;
- /**
- * Creates a new player with a given name and starting capital.
- *
- * @param name the name of the player
- * @param startingMoney the starting amount of money
- */
- public Player(String name, BigDecimal startingMoney) {
- this.name = name;
- this.startingMoney = startingMoney;
- this.money = this.startingMoney;
- this.portfolio = new Portfolio();
- this.transactionArchive = new TransactionArchive();
- }
+ /**
+ * Starting money of player.
+ * */
+ private final BigDecimal startingMoney;
- /**
- * Returns the name of the player.
- *
- * @return the player's name
- */
- public String getName() {
- return name;
- }
+ /**
+ * Current money of player.
+ * */
+ private BigDecimal money;
- /**
- * Returns the players current balance.
- *
- * @return the current amount of money
- */
- public BigDecimal getMoney() {
- return money;
- }
+ /**
+ * The players' portfolio, holding their shares.
+ * */
+ private final Portfolio portfolio;
- /**
- * Adds money to the players balance.
- *
- * @param amount the amount to add
- */
- public void addMoney(BigDecimal amount) {
- money = money.add(amount);
- }
+ /**
+ * The players' transaction archive,
+ * holding a history of transactions on the exchange.
+ * */
+ private final TransactionArchive transactionArchive;
- /**
- * Withdraws money from the players balance.
- *
- * @param amount the amount to withdraw
- */
- public void withdrawMoney(BigDecimal amount) {
- money = money.subtract(amount);
- }
+ /**
+ * Creates a new player with a given name and starting capital.
+ *
+ * @param name the name of the player
+ * @param startingMoney the starting amount of money
+ */
+ public Player(final String name, final BigDecimal startingMoney) {
+ this.name = name;
+ this.startingMoney = startingMoney;
+ this.money = this.startingMoney;
+ this.portfolio = new Portfolio();
+ this.transactionArchive = new TransactionArchive();
+ }
- /**
- * Returns the players portfolio.
- *
- * @return the portfolio
- */
- public Portfolio getPortfolio() {
- return portfolio;
- }
+ /**
+ * Returns the name of the player.
+ *
+ * @return the player's name
+ */
+ public String getName() {
+ return name;
+ }
- /**
- * Returns the players transaction archive.
- *
- * @return the transaction archive
- */
- public TransactionArchive getTransactionArchive() {
- return transactionArchive;
- }
-}
\ No newline at end of file
+ /**
+ * Returns the players current balance.
+ *
+ * @return the current amount of money
+ */
+ public BigDecimal getMoney() {
+ return money;
+ }
+
+ /**
+ * Adds money to the players balance.
+ *
+ * @param amount the amount to add
+ */
+ public void addMoney(final BigDecimal amount) {
+ money = money.add(amount);
+ }
+
+ /**
+ * Withdraws money from the players balance.
+ *
+ * @param amount the amount to withdraw
+ */
+ public void withdrawMoney(final BigDecimal amount) {
+ money = money.subtract(amount);
+ }
+
+ /**
+ * Returns the players portfolio.
+ *
+ * @return the portfolio
+ */
+ public Portfolio getPortfolio() {
+ return portfolio;
+ }
+
+ /**
+ * Returns the players transaction archive.
+ *
+ * @return the transaction archive
+ */
+ public TransactionArchive getTransactionArchive() {
+ return transactionArchive;
+ }
+
+ /**
+ * Returns the total net worth of the player,
+ * including the shares in the players' portfolio.
+ *
+ * @return the net worth of the player.
+ * */
+ public BigDecimal getNetWorth() {
+ BigDecimal netWorth = new BigDecimal("0");
+ netWorth = netWorth.add(portfolio.getNetWorth()).add(money);
+ return netWorth;
+ }
+}