Question
This lab will test your ability to overload operators.You have been given five files: BankMain.cpp, BankManager.cpp, BankManager.h, InvestmentAccount.cpp and InvestmentAccount.h. BankMain.cpp has been completely implemented
This lab will test your ability to overload operators.You have been given five files: BankMain.cpp, BankManager.cpp, BankManager.h, InvestmentAccount.cpp and InvestmentAccount.h. BankMain.cpp has been completely implemented for you. BankManager.cpp and BankManager.h are missing one function, the overload of the == operator.InvestmentAccount.cpp and InvestmentAccount.h are mostly empty. The only functions implemented are PurchaseStocks and SellStocks. The others have not.
For BankManager.cpp, implement the overloading of the == operator such that true is returned if the names of the investment accounts are the same, false otherwise. Do not forget the function prototype in the header file BankManager.h
For InvestmentAccount.cpp, implement the overload of the += operator. This should add cash to the investment account. If the amount to be added is negative, print out the error message "Invalid transaction". Do not forget the function prototype in the header file InvestmentAccount.h.
For InvestmentAccount.cpp, implement the overload of the -= operator. This should subtract cash from the investment account. If the amount to be subtracted is negative, print out the error message "Invalid transaction". If there isn't enough cash in the account, print out the error message "Not enough funds in the account for
Implement the constructors for InvestmentAccount. The variables name and cash should default to "" and 0.0 respectively.
Implement all getter functions for InvestmentAccount - GetName(), GetValue(), GetStocks() and GetCash().
Implement the destructor for InvestmentAccount. Be sure to wipe out all information.
A sample run is as follows:
David Sands has $18900 in stocks and $1100 in cash. Kamla Patel has $27880 in stocks and $2120 in cash. Wing Chung has $44678 in stocks and $5322 in cash. Not enough funds in the account for Kamla Patel. David Sands has $18900 in stocks and $6100 in cash. Kamla Patel has $27880 in stocks and $2120 in cash. Wing Chung has $44678 in stocks and $15322 in cash. clients 2 and 3 are the same
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started