Skip to content

Commit

Permalink
Changed Exchange to use TransactionFactory
Browse files Browse the repository at this point in the history
  • Loading branch information
Solveig Natvig committed May 24, 2026
1 parent 74e51ac commit 0f452a2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/main/java/Model/Exchange.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ public Transaction buy(String symbol, BigDecimal quantity, Player player) {
// lager en ny "andel" basert på nåværende salgspris
Share shareToBuy = new Share(stock, quantity, stock.getSalesPrice());

// oppretter kjøpstransaksjonen for den uka
Purchase purchase = new Purchase(shareToBuy, this.week);
// oppretter kjøpstransaksjonen for den uka via fabrikken
Transaction purchase = TransactionFactory.createPurchase(shareToBuy, this.week);

// committer til player
purchase.commit(player);
Expand All @@ -81,8 +81,8 @@ public Transaction sell(Share share, Player player) {
return null;
}

// oppretter salgstransaksjonen for den uka
Sale sale = new Sale(share, this.week);
// oppretter salgstransaksjonen for den uka via fabrikken
Transaction sale = TransactionFactory.createSale(share, this.week);

// commiter til player
sale.commit(player);
Expand Down

0 comments on commit 0f452a2

Please sign in to comment.