This question has been answered before, but please understand that the display has to be exactly like the one I have on here. Please read carefully and try to help me achieve that display (PLEASE READ THE OUTCOME SECTION AND TRY TO MAKE IT EXACT TO THAT):
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:
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.
You will get yellow highlighted text when you run the tests if your output is not what is expected. This can be because you are not getting the correct result. It could also be because your formatting does not match what is required. The checking that zyBooks does is very exacting and you must match it exactly. More information about what the yellow highlighting means can be found in course "How to use zyBooks" - especially section "1.4 zyLab basics".
Finally, do not include a system("pause"); statement in your program. This will cause your verification steps to fail.
Note: that the system("pause"); command runs the pause command on the computer where the program is running. The pausecommand is a Windows command. Your program will be run on a server in the cloud. The cloud server may be running a different operating system (such as Linux).
Dear student,
Program:
#include <iostream>
#include<string>
#include<iomanip>
#include<math.h>
using namespace std;
int main()
{
char cname[50];
const double comm = 3.5;
int shares;
double purchase, sale;
double cost, tc, c_c;
double income, ti, i_c, diff;
cin.get(cname, 100);
cin>>shares;
cin>>purchase;
cin>>sale;
cout<<endl;
cost = purchase * shares;
c_c = (comm * cost)/100;
tc = cost + c_c;
income = sale * shares;
i_c = (comm * income)/100;
ti = income - i_c;
diff = ti - tc;
cout<<"Company: "<<cname<<endl;
cout<<"Shares: "<<shares<<endl;
cout<< fixed << setprecision(2);
cout<<"\nPurchase/share: $"<<purchase <<
setprecision(2) <<fixed <<endl;
cout<<"Cost of stock: $"<<cost<<setprecision(2)
<<fixed <<endl;
cout<<"Cost of commission:
$"<<c_c<<setprecision(2) <<fixed
<<endl;
cout<<"Total cost: $"<<tc<<setprecision(2)
<<fixed <<endl;
cout<<"\nSale/share:
$"<<sale<<setprecision(2) <<fixed
<<endl;
cout<<"Income from stock:
$"<<income<<setprecision(2) <<fixed
<<endl;
cout<<"Cost of commission:
$"<<i_c<<setprecision(2) <<fixed
<<endl;
cout<<"Total income: $"<<ti<<setprecision(2)
<<fixed <<endl;
/* if you want to print gain or loss along with the cost
if(diff > 0)
cout<< "\nGain or loss: $"<<diff<<"
loss"<<endl;
else
cout<< "\nGain or loss: $"<<fabs(diff)<<"
gain"<<endl; */
cout<<"\nGain or loss: $"<<diff<<endl;
return 0;
}
Output:


Thank you, All the best.
If at all any doubts, feel free to contact through the comment section.
This question has been answered before, but please understand that the display has to be exactly...
Last month Joe purchased some stock in Acme Software, Inc. Here are the details of the purchase: The number of shares that Joe purchased was 1,000. When Joe purchased the stock, he paid $45.50 per share. Joe paid his stockbroker a commission that amounted to 2% of the amount he paid for the stock Two weeks later Joe sold the stock. Here are the details of the sale: The number of shares that Joe sold was 1,000. He sold the...
Please take a screenshot or picture of work done in the PYTHON
SHELL to see steps. Thank you.
• Make sure to test your program before submit. Last month, Joe purchased some stock in Acme Software, Inc. Here are the details of the purchase: • The number of shares that Joe purchased was 2000. • When Joe purchased the stock, he paid $40.00 per share. • Joe paid his stockbroker a commission that amounted to 3 percent of the amount...
Please use C++ only
CSIT163 Project 1 - Taking Stock Recently, Joe Btfsplk purchased some stock in Acme Software, Inc. The details of the purchase are as follows: • 1,000 shares at $32.87 per share. • The stockbroker received $5 dollars plus a commission of 2% of the total purchase. Should he decide to sell, the stockbroker receives $5 dollars plus a commission of 2% of the total sale. Feeling jittery, Joe is considering selling the stock. The only thing...
10. Stock Transaction Program 18pts Last month Joe purchased some stock in Acme Software, Inc. Here are the details of the purchase: • The number of shares that Joe purchased was 1,000. • When Joe purchased the stock, he paid $32.87 per share. • Joe paid his stockbroker a commission that amounted to 2 percent of the amount he paid for the stock. Two weeks later Joe sold the stock. Here are the details of the sale: • The number...
Problem Statement Last month Tian purchased some stock in Acme Software, Inc. Here are the details of the purchase: The number of shares that Tian purchased was 1,000 When Tian purchased the stock, he paid $33.92 per share Tian paid his stockbroker a commission that amounted to 2% of the amount he paid for the stock. One week later, Tian sold the stock. Here are the details of the sale: The number of shares sold was 1,000...
walk me through all of these problems
Selling Stocks When you sell your stocks, the sale can result in either a profit or a loss. You profit when the sale amoun minus the sales commission is greater than the original purchase amount. Your sale results in a loss when the sale amount minus the sales commission is less than the original purchase amount NET SALE - AMOUNT OF SALE COMMISSION PROFIT - NET SALE TOTAL PAID LOSS - TOTAL PAID...
General overview This program will convert a set of temperatures from Fahrenheit to Celsius and Kelvin. Your program will be reading in three double values. The first values are starting and ending temperatures. The third value is the increment value. There is no prompt for the input. There is an error message that can be displayed. This is discussed later. You need to display output for all of the values between the starting and ending values. First two values are...
please walk me through the rest of the problems
When you purchase a share of stock, you become a part owner of the company that issues the stock. The total amount you pay for the stock depends on the cost per share, the number of shares you purchase, and the stockbroker's commission. When you buy stock, you may receive dividends. If you consider annual dividends an important factor in investing, you can use the annual yield to compare different stocks...
18.1 Lab Lesson 11 (Part 1 of 1) Part of lab lesson 11 There in one part to lab lesson 11. The entire lab will be worth 100 points. Lab lesson 11 part 1 is worth 100 points For part 1 you will have 80 points if you enter the program and successfully run the program tests. An additional 20 points will be based on the style and formatting of your C++ code. Style points The 20 points for coding...
This question has already been answered however I do
not understand the particulars of the answer. for an example why
are we importing an average class I thought that we could solve the
problem just inputting the scanner and doing the import command at
the top. Also at the bottom of the problem they increment the
counter I thought you increment the counter at the top. Is there
any way someone could do a detailed step-by-step explanation of the
actual...