Skip to content

Commit

Permalink
Added Stock class
Browse files Browse the repository at this point in the history
  • Loading branch information
elisab3 committed Feb 24, 2026
1 parent 0ec9bd5 commit bc38441
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/main/java/Stock.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

public class Stock {

private final String symbol;
private final String company;
private final List<BigDecimal> prices;

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

public String getSymbol() {
return symbol;
}

public String getCompany() {
return company;
}

public BigDecimal getSalesPrice() {
return prices.get(prices.size() - 1);
}

public void addNewSalesPrice(BigDecimal price) {
prices.add(price);
}
}
Binary file added target/classes/Stock.class
Binary file not shown.

0 comments on commit bc38441

Please sign in to comment.