Skip to content

Commit

Permalink
fixed sales price implimentation
Browse files Browse the repository at this point in the history
  • Loading branch information
peretr committed Feb 16, 2026
1 parent 7c28b72 commit 3ddd0a4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/main/java/edu/ntnu/idi/idatt2003/gruppe42/Model/Stock.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
package edu.ntnu.idi.idatt2003.gruppe42.Model;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

public class Stock {
private final String symbol;
private final String company;
private List<BigDecimal> prices;
private List<BigDecimal> prices = new ArrayList<>();

public Stock(String symbol, String company, List<BigDecimal> prices) {
public Stock(String symbol, String company, BigDecimal salesPrice) {
this.symbol = symbol;
this.company = company;
this.prices = prices;
prices.add(salesPrice);
}

public String getSymbol() {
Expand All @@ -22,11 +23,11 @@ public String getCompany() {
return company;
}

public List<BigDecimal> getSalesPrices() {
return prices;
public BigDecimal getSalesPrice() {
return prices.getLast();
}

public void addNewSalesPrices(List<BigDecimal> prices) {
this.prices = prices;
public void addNewSalesPrices(BigDecimal salesPrice) {
prices.add(salesPrice);
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
package edu.ntnu.idi.idatt2003.gruppe42.Model.Transaction;

import java.math.BigDecimal;

public class Purchase {
}

0 comments on commit 3ddd0a4

Please sign in to comment.