Design a class named “InvestmentPortfolio” that shows a summary of your investment portfolio or the full details of your portfolio with the change percent in the stocks’ prices. The class contains the following tasks:

40 0

Get full Expert solution in seconds

$1.97 ONLY

Unlock Answer

Design a class named “InvestmentPortfolio” that shows a summary of your investment portfolio or the full details of your portfolio with the change percent in the stocks’ prices. The class contains the following tasks:

1 – Create the following variables: A string data field named “symbol” for the stock’s symbol. A string data field named “name” for the stock’s name. A double data field named “previousClosingPrice” that stores the stock price for the previous day. A double data field named “currentPrice” that stores the stock price for the current time. An int data field named “clientServiceID” that stores the portfolio service required. A String field named “clientName” that stores the client’s name. A String field named “”clientID” that stores the client ID with the format (0000-0000).

2 – Create the following function: A method named “getChangePercent()” that returns the percentage changed from previous closing prices to current prices with the format (00.00%). Note: The percent change formula is as follows: Change Percent=(current price-prevoius closing price)/(prevoius closing price)*100

3- Promote the client to insert his\her full name and Client ID. insert the service id. If the client inserts 1, then the portfolio summary will be shown. If the client inserts 2, then the full details of portfolio will be shown with calling getChangePercent() function. If the client inserts 0, then the program will be closed.

4- Create the following variables: A single dimensional string array named “stockSymbolsList” with the values “2222.SR”, “2010.SR”, and “1150.SR” A single dimensional string array named “stockNameList” with the values “Saudi Aramco”, “SABIC”, and “Alinma Bank” A single dimensional float array named “previousClosingPrice” with the values 30.91, 89.29, and 12.30 A single dimensional float array named “currentPrice” with the values 35.85, 88.80, and 36.50

5 – Create the following three selection tools (but not limited to): An one-way if statement to check the service id inserted by the client. A switch statement to select the required service from Step 3.b. For loops to read\print from the created arrays when necessary.

EXPERT ANSWER