Class Portfolio
java.lang.Object
|
+--Portfolio
- public class Portfolio
- extends java.lang.Object
|
Constructor Summary |
Portfolio()
default constuctor |
|
Method Summary |
void |
addStock(Stock newStock,
int shares)
method to add a stock to the existing portfolio |
double |
getBuyValue()
method to get the value of the portfolio at the time of purchase |
int |
getDaysSincePurchase()
method to get the number of days since the purchase of the portfolio |
double |
getTotalValue()
method to get the current total value of the portfolio |
void |
setTotalValue()
method to set the total value for the portfolio based on the array of stocks |
java.lang.String |
toString()
generate output report with values for portfolio |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Portfolio
public Portfolio()
- default constuctor
getTotalValue
public double getTotalValue()
- method to get the current total value of the portfolio
getBuyValue
public double getBuyValue()
- method to get the value of the portfolio at the time of purchase
getDaysSincePurchase
public int getDaysSincePurchase()
- method to get the number of days since the purchase of the portfolio
setTotalValue
public void setTotalValue()
- method to set the total value for the portfolio based on the array of stocks
addStock
public void addStock(Stock newStock,
int shares)
- method to add a stock to the existing portfolio
toString
public java.lang.String toString()
- generate output report with values for portfolio
- Parameters:
no - parameters- Returns:
- report with number of stocks, the purchase value of the portfolio in US$,
how many days since purchase, a line listing of each stock by sector
indicating current value in US$ and change in price in US$ since purchase,
the current value of the stock by firm in US$, and the current total value of the
portfolio in US$ and change in value of the portfolio in US$ since purchase.
- Overrides:
- toString in class java.lang.Object