diff --git a/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/Share.java b/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/Share.java index 09c577b..d27478a 100644 --- a/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/Share.java +++ b/src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/Share.java @@ -1,5 +1,56 @@ package edu.ntnu.idi.idatt2003.g40.mappe; +import java.math.BigDecimal; + +/** + * Represents a share owned by a player. + *
+ * A share contains information about which stock was purchased, + * the quantity purchased, and the purchase price. + *
+ */ public class Share { - + private final Stock stock; + private final BigDecimal quantity; + private final BigDecimal purchasePrice; + + /** + * Creates a new {@code Share}. + * + * @param stock the stock that was purchased + * @param quantity the quantity purchased + * @param purchasePrice the price per unit at purchase time + */ + public Share(Stock stock, BigDecimal quantity, BigDecimal purchasePrice) { + this.stock = stock; + this.quantity = quantity; + this.purchasePrice = purchasePrice; + } + + /** + * Returns the stock associated with this share. + * + * @return the stock + */ + public Stock getStock() { + return stock; + } + + /** + * Returns the quantity of the stock owned. + * + * @return the quantity + */ + public BigDecimal getQuantity() { + return quantity; + } + + /** + * Returns the purchase price per unit. + * + * @return the purchase price + */ + public BigDecimal getPurchasePrice() { + return purchasePrice; + } }