-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Solveig Natvig
committed
Feb 28, 2026
1 parent
ffe1266
commit 32b5cb7
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| import java.math.BigDecimal; | ||
|
|
||
| public class Player { | ||
| private String name; | ||
| private BigDecimal startingMoney; | ||
| 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 String getName() { | ||
| return this.name; | ||
| } | ||
|
|
||
| public BigDecimal getMoney() { | ||
| return this.money; | ||
| } | ||
|
|
||
| public void addMoney(BigDecimal amount) { | ||
| this.money.add(amount); | ||
| } | ||
|
|
||
| public void withdrawMoney(BigDecimal amount) { | ||
| this.money.subtract(amount); | ||
| } | ||
|
|
||
| public Portfolio getPortfolio() { | ||
| return this.portfolio; | ||
| } | ||
|
|
||
| public TransactionArchive getTransactionArchive() { | ||
| return this.transactionArchive; | ||
| } | ||
|
|
||
|
|
||
| } |