Class Portfolio

java.lang.Object
  extended by Portfolio

public class Portfolio
extends java.lang.Object


Constructor Summary
Portfolio()
          Creates a Portfolio with default checking account, null stock, and zero shares of that stock.
Portfolio(BankAccount checking, Stock myStock, int numShares)
          Creates a Portfolio with given checking account, and given number of shares in the given stock.
Portfolio(Portfolio p)
          Creates a copy of the given portfolio.
 
Method Summary
 double getPortfolioBalance()
          Calculates the total portfolio balance.
 java.lang.String toString()
          Returns a string representation of the portfolio.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Portfolio

public Portfolio(BankAccount checking,
                 Stock myStock,
                 int numShares)
Creates a Portfolio with given checking account, and given number of shares in the given stock. The bank accout is defensively copied.

Parameters:
checking - Checking account
myStock - Stock
numShares - Number of shares in the stock

Portfolio

public Portfolio()
Creates a Portfolio with default checking account, null stock, and zero shares of that stock.


Portfolio

public Portfolio(Portfolio p)
Creates a copy of the given portfolio.

Parameters:
p - Portfolio to be copied.
Method Detail

getPortfolioBalance

public double getPortfolioBalance()
Calculates the total portfolio balance.

Returns:
Total portfolio balance

toString

public java.lang.String toString()
Returns a string representation of the portfolio.

Overrides:
toString in class java.lang.Object
Returns:
String representation of the portfolio.