Question: 9.2 Using C++ Student Instructions: 1. Implement code that contains variables of type pointer. 2. Implement your code; 3. Submit your solution as a PDF

9.2

Using C++

Student Instructions: 1. Implement code that contains variables of type pointer. 2. Implement your code; 3. Submit your solution as a PDF file.

Description of the problem: 1. (Gaddis) Program Challenges 20. Stock Profit, page 372 Chap 6.

9.2 Using C++ Student Instructions: 1. Implement code that contains variables of 1. Define variables of type pointer pointing to the variables defined for the problem solution. 2. Implement a function for each of the values entered by the user. 3. Implement the function to calculate the profit from the sale of the shares 4. Implement a function that prints the results. 5. The input parameters of each of the functions must be variables of the pointer type.

20. Stock Profit The profit from the sale of a stock can be calculated as follows: Profit = ((NS X SP) SC) ((NS X PP) + PC) where NS is the number of shares, SP is the sale price per share, SC is the sale commis- sion 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. Write a function 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. Programming Challenges 373 Demonstrate the function in a program that asks the user to enter the necessary data and displays the amount of the profit or loss

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!