Skip to content

Commit

Permalink
javadoc
Browse files Browse the repository at this point in the history
adding java documentation to the Share class
  • Loading branch information
EspenTinius committed Feb 11, 2026
1 parent 160d1ef commit da9d5c5
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/main/java/edu/ntnu/idi/idatt2003/g40/mappe/Share.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,54 @@

import java.math.BigDecimal;

/**
* Represents a share owned by a player.
* <p>
* A share contains information about which stock was purchased,
* the quantity purchased, and the purchase price.
* </p>
*/
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;
}
Expand Down

0 comments on commit da9d5c5

Please sign in to comment.