Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ requirements The commission percentage (see below) must be put into a const double variable that you will use in your calculations. The numeric variables

C++ requirements

The commission percentage (see below) must be put into a const double variable that you will use in your calculations. The numeric variables in your program need to be of type double.

Failure to follow the C++ requirements could reduce the points received from passing the tests.

General overview

Next you will read in the number of shares of stock, a stock purchase price, and a stock sale price. The number of shares will always be an integer value.

With this data calculate the total amount required to purchase the stock. You also need to calculate the commission that has to be paid to the stockbroker. The stockbroker commission will be 3.5% of the amount required to purchase the stock.

Note: the commission percentage must be put into a const double variable that you will use in your calculations. The numeric variables in your program need to be of type double.

Output the name of the company, the cost of a share of stock, the total amount required to pay for the stock (not including the commission), the commission, and the total cost of the stock (including the commission).

Next calculate the amount of income you will get when you sell the stock for the stock sales price. You also need to calculate the cost of the commission to the stockbroker for the sale of the stock. Again this will be 3.5% of the money you get for selling the stock.

Output the price of one share of stock, the amount of money you get from the sale (before the commission is paid), the amount of the commission, and the amount of money you get from the sale after you have paid the commission to the stockbroker. All of the money amounts should be output in a fixed format with two digits to the right of the decimal point.

Final calculate the difference between what you paid for the stock (including the commission), and what you received when you sold the stock (less the commission). This number will be negative if you have lost money.

Here is some sample input data:

 

The output from the above input will be:

 

Failure to follow the requirements for lab lessons can result in deductions to your points, even if you pass the validation tests. Logic errors, where you are not actually implementing the correct behavior, can result in reductions even if the test cases happen to return valid answers. This will be true for this and all future lab lessons.

Expected output

image text in transcribed

Output the price of one share of stock, the amount of money you get from the sale (before the commission is paid), the amount of the commission, and the amount of money you get from the sale after you have paid the commission to the stockbroker. All of the money amounts should be output in a fixed format with two digits to the right of the decimal point. Final calculate the difference between what you paid for the stock (including the commission), and what you received when you sold the stock (less the commission). This number will be negative if you have lost money Here is some sample input data Acme Software, Inc. 1000 45.50 56.90 The output from the above input will be Company: Acme Software, Inc. Shares: 1000 Purchase/share: $45.50 Cost of stock: $45500.00 Cost of commission: $1592.50 Total cost:$47092.50 Sale/share: $56.90 Income from stock: $56900.00 Cost of commission: $1991.50 Total income: $54908.50 Gain or loss: $7816.00 Failure to follow the requirements for lab lessons can result in deductions to your points, even if you pass the validation tests. Logic errors, where you are not actually implementing the correct behavior, can result in reductions even if the test cases happen to return valid answers. This will be true for this and all future lab lessons. Expected output There are five tests. Each test will have a new set of input data. You must match, exactly, the expected output

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions