Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 ". 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_2

Step: 3

blur-text-image_3

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

Databases And Python Programming MySQL MongoDB OOP And Tkinter

Authors: R. PANNEERSELVAM

1st Edition

9357011331, 978-9357011334

More Books

Students also viewed these Databases questions

Question

How does a prospective exporter choose an export market?

Answered: 1 week ago

Question

What are the pros and cons regarding Angelica joining the union?

Answered: 1 week ago