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
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