(This is for an intro to C++ course so it doesn\'t need to be fancy\") Example U
ID: 668238 • Letter: #
Question
(This is for an intro to C++ course so it doesn't need to be fancy") Example User Interface: Enter of shares purchased 100 1. Write a program that asks the user the following Enter price/share 12 Enter purchase commission 9%) 10 number of shares purchased Enter of shares sold 100 price per share Enter price/share 13 purchase commission Enter selling commission (9%) 10 OUTPUT number of shares sold Amount Invested 1320.00 price per share Final Value 1170.00 Net Gain -150.00 selling commission AND then it takes the input and performs the math which it then outputs (to the console the total gain (positive) or loss(negative) of the user's portfolio the amount invested And the final value. Assume the user spends ALL of her/his money buying the stock and that he/she sells all of the stock Make sure to output dollar figures to two decimal places and align the decimal places ThanksExplanation / Answer
#include<iostream.h>
#include<conio.h>
void main()
{
float sp,pp,cp,ss,sp1,cs,amtp,amts,fin,net;
clrscr();
cout<<"Example USer Interface:";
cout<<" Enter # of shares purchased ->";
cin>>sp;
cout<<" Enter price/share ->";
cin>>pp;
cout<<" Enter purchase commission(%) ->";
cin>>cp;
cout<<" Enter # of shares sold ->";
cin>>ss;
cout<<" Enter price/share ->";
cin>>sp1;
cout<<" Enter selling commission(%) ->";
cin>>cs;
amtp= sp*pp+((sp*pp*10)/100);
cout<<"Amount Invested -> $ "<<amtp;
amts= ss*sp1+((ss*sp1*10)/100);
fin=amts-amtp;
cout<<" Final Value -> $ "<<amts;
cout<<" Net Gain -> $ "<<fin;
getch();
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.