Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Beginning Microsoft SQL Server 2012 Programming

Authors: Paul Atkinson, Robert Vieira

1st Edition

1118102282, 9781118102282

More Books

Students also viewed these Databases questions