Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This lab will test your ability to overload operators.You have to use C++. BankManager.cpp and BankManager.h are missing one function, the overload of the ==

This lab will test your ability to overload operators.You have to use C++.

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 ". Be sure to insert the name in the error message. See the sample run below as an example. Do not forget the function prototype in the header file InvestmentAccount.h

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Consistently develop management talent.

Answered: 1 week ago

Question

Create a refreshed and common vision and values across Europe.

Answered: 1 week ago

Question

Provide the best employee relations environment.

Answered: 1 week ago