diff --git a/src/main/java/edu/ntnu/idi/idatt2003/gruppe42/Model/Share.java b/src/main/java/edu/ntnu/idi/idatt2003/gruppe42/Model/Share.java index 41c7ed1..8f645dc 100644 --- a/src/main/java/edu/ntnu/idi/idatt2003/gruppe42/Model/Share.java +++ b/src/main/java/edu/ntnu/idi/idatt2003/gruppe42/Model/Share.java @@ -2,11 +2,24 @@ import java.math.BigDecimal; +/** + * Represents a share of a particular stock owned by a player. + *
+ * A {@code Share} keeps track of the stock it represents, the quantity owned, + * and the purchase price at which it was bought. + *
+ */ public class Share { private Stock stock; private BigDecimal quantity; private BigDecimal purchasePrice; + /** + * Constructs a new {@code Share} given the given stock, quantity, and purchase price. + * @param stock stock the stock that this share represents + * @param quantity quantity the number of shares owned + * @param purchasePrice purchasePrice the price per share at the time of purchase + */ public Share(Stock stock, BigDecimal quantity, BigDecimal purchasePrice) { this.stock = stock; this.quantity = quantity; diff --git a/src/main/java/edu/ntnu/idi/idatt2003/gruppe42/Model/Stock.java b/src/main/java/edu/ntnu/idi/idatt2003/gruppe42/Model/Stock.java index bd4192c..6472647 100644 --- a/src/main/java/edu/ntnu/idi/idatt2003/gruppe42/Model/Stock.java +++ b/src/main/java/edu/ntnu/idi/idatt2003/gruppe42/Model/Stock.java @@ -4,11 +4,24 @@ import java.util.ArrayList; import java.util.List; +/** + * Represents a stock of a company in the {@link Exchange}. + *+ * Each {@code Stock} has a unique symbol, a company name, and a history of sales prices. + * You can retrieve the current price or add new prices as the market changes. + *
+ */ public class Stock { private final String symbol; private final String company; private List