|
|
You have been developing a BankAccount class for Parkville Bank that contains several fields and functions. In previous chapters, you declared the interest rate to be static and constant; remove those modifiers as well as the definition of the interest rate as 0.03. Add a constructor to the class that accepts arguments for the account number, balance, and interest rate. The account number is required, but both the balance and interest rate default to 0 if no argument is supplied to the constructor. If the account number is not between 1000 and 9999 inclusive, force it to zero. Modify the display function, if necessary, so that all BankAccountfields are displayed. Write a main()function that declares several BankAccountobjects and confirm that the class works correctly. Save the file as BankAccount.cpp. b. Parkville Investment Consulting keeps track of clients’ asset portfolios. Create a class named Portfoliothat contains a client number and two BankAccountobjects—one for checking and one for savings. Include two other double fields for stock market holdings total value and real estate holdings total value. The Portfolioconstructor requires checking account data (account number and balance), savings account data (account number, balance, and interest rate), and the value of stock market and real estate holdings. The constructor calls a function named balancePortfolio()that determines the relative percentage of the client’s holdings in each of the four investment types. If any investment type’s value is more than 40% of the client’s total holdings, an appropriate message displays warning that the client’s portfolio might be out of balance. Also create a display function for the Portfolio class to display all the details. Add any additional functions you need to the classes. Write a main()function that continues to prompt a user for Portfoliodata until a negative value is entered for the client account number. Create each Portfolioobject and display its values, including the possible out-of-balance warning message. Save the file as Portfolio.cpp. |
|
|
|
|
The Portfolioconstructor requires checking account data (account number and balance), savings account data (account number, balance, and interest rate), and the value of stock market and real estate holdings. |
The Portfolio constructor requires checking account data (account number and balance) |
|
|