Skip to content

Commit

Permalink
Adding player class
Browse files Browse the repository at this point in the history
  • Loading branch information
martin committed Mar 5, 2026
1 parent a1a4d2e commit 570e37c
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/main/java/temppackage/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,36 @@ public class Player {
private BigDecimal money;
private Portfolio portfolio;
private TransactionArchive transactionArchive;

public Player(String name, BigDecimal startingMoney) {
this.name = name;
this.startingMoney = startingMoney;
this.money = startingMoney;
this.portfolio = new Portfolio();
this.transactionArchive = new TransactionArchive();
}

public void addMoney(BigDecimal amount) {
this.money = this.money.add(amount);
}

public void withdrawMoney(BigDecimal amount) {
this.money = this.money.subtract(amount);
}

public String getName() {
return this.name;
}

public BigDecimal getMoney() {
return this.money;
}

public Portfolio getPortfolio() {
return this.portfolio;
}

public TransactionArchive getTransactionArchive() {
return this.transactionArchive;
}
}

0 comments on commit 570e37c

Please sign in to comment.