////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* PIMS: Personal Invstment Management System Class : Portfolio Descrption: This class correspond to a Portfolio. Any access to Portfolio (access/modification/edit portfolios/securities/ transaction etc.) is done through the instance of this class. The attributes are: 1> A list of all Security Names with attributes. 2> Net-worth of the portfolio 3> ComputeNetWorth(): Returns the value of Net-Worth. Each time the Investment is accessed, the value of the Net-Worth is modified. 4> ComputeROI(): Computes the ROI of a particular security 5> Add/Delete/Rename/Edit Security/Transaction */ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public class Portfolio{ private dataRepository DR; private CurrentValueSystem CVS; private String PortfolioName;//Name of this portfolio private SecurityDS SecurityList[];//A list of all Securities private int NumSecurities;//Number of securities private double NetWorth;//The networth of the Portfolio public Portfolio(dataRepository DR, CurrentValueSystem CVS, String PortfolioName)throws Exception{ this.DR = DR; this.CVS = CVS; this.PortfolioName = PortfolioName; //Initialize the Security list by reading from the //previously initialized file "securities" in the //HOME/.pims/Investment directory SecurityList = DR.ReadSecurityList(PortfolioName); //Count the number of securities while(SecurityList[NumSecurities] != null)NumSecurities++; } public boolean ReturnTypeOfSecurity(String SecurityName)throws Exception{ int i; for(i=0;i