Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Last month Joe purchased 100 shares of stock. Here are the details of the purcha

ID: 668669 • Letter: L

Question

Last month Joe purchased 100 shares of stock. Here are the details of the purchase:

- When Joe purchased the stock, he paid $32.87 per share.

- Joe paid his stock broker a commission that amounted to 2% of the amount he paid for the stock.

Two months laer Joe sold the stock. Here are the details of the sale:

- He sold the stock for $33.92 per share.

- He paid his stock broker another commission that amounted to 2% of the amount he received for the stock.

Write a program that displays the following information:

-The amount of money Joe paid for the stock.

-The amount of commision Joe paid his broker when he bought the stock.

-The amount that Joe sold the stock for.

-The amount of commission Joe paid his broker when he sold the stock.

-The amount of profit or loss that Joe had after selling his stock and paying both broker commissions.

---Note: I must use #include <iomanip>

and I have only done programming up til Ch.3- C++ Early Objects by Tony Gaddis. So I cannot have programming methods beyond Ch.3 like if/else statements and loops (haven't learned those yet)

Explanation / Answer

#include<iostream.h>
#include<conio.h>
#include<iomanip.h>

void main()
{
   float p,c1,s,c2,tot;

   clrscr();

   p=100*32.87;
   cout<<" Amount of money paid for stock" <<p;
   c1=p*2/100;
   cout<<" Amount of commissiom paid for purchase of stock"<<c1;

   s=100*33.92;
   cout<<" Amount of money got from stock" <<s;
   c2=s*2/100;
   cout<<" Amount of commissiom paid for selling of stock"<<c2;

   tot=(s+c2)-(p+c1);
   cout<<" Amount of profit after selling stock and paying both commission is "<<tot;
   getch();
}