Question: Write a program using C++ (using appropriate functions) that accepts as arguments the number of shares, the purchase price per share, the purchase commission paid,

Write a program using C++ (using appropriate functions) that accepts as arguments the number of shares, the purchase price per share, the purchase commission paid, the sale price per share, and the sale commission paid. The function should return the profit (or loss) from the sale of stock.

Stock Profit: The profit from the sale of a stock can be calculated as follows:

Profit = ((NS * SP) SC) ((NS * PP) + PC)

Where

NS is the number of shares,

SP is the sale price per share,

SC is the sale commission paid,

PP is the purchase price per share, and

PC is the purchase commission paid.

If the calculation yields a positive value, then the sale of the stock resulted in a profit. If the calculation yields a negative number, then the sale resulted in a loss.

Please use good comments in the code. (If possible please finished before the end of today) Thanks.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!