Question

In: Computer Science

In C++ Design a program to calculate the stock purchasing and selling transactions. 1. ask the...

In C++

Design a program to calculate the stock purchasing and selling transactions.

1. ask the user to enter the name of the stock purchased, the number of share purchased, and the price per share purchased

2. assume the buyer pays 2% of the amount he paid for the stock purchase as broker commission

3. assume that the buyer sold all stocks. Ask the user to enter the price per share sold.

4. assume the buyer will pay another 2% of the amount he received for selling the stock as broker commission


the program will calculate and display:

1. the amount of money he paid for the stock purchase

2. the amount of commission he paid to the broker for purchase transaction

3. the amount he sold the stock for

4. the amount of commission he paid to the broker for purchase selling

5. the possible profit he made after selling his stock and paying the two commissions to the broker

Requirements:

1. program well documented

Solutions

Expert Solution

#include <iostream>

using namespace std;

int main()
{
string name;
int number,bPrice,sPrice,bTotal,sTotal;
int sCommision,bCommision,profit;
//readin the stack details
cout<<"Enter the name of the stock: ";
cin>>name;
cout<<"Enter number of shares purchased: ";
cin>>number;
cout<<"Price of each share : ";
cin>>bPrice;
// calculating the total amount for stock purchase
bTotal=bPrice * number;
// finding the broker commission
bCommision=bTotal*0.02;
  
//reading the selling price
cout<<"Enter the price of share sold: ";
cin>>sPrice;
  
// finding the total amount he got
sTotal=sPrice*number;
// finding the commission
sCommision=sTotal*0.02;
// finding the profit
profit=sTotal-bTotal;
//removing the 2 broker commission from the profit
profit=profit-bCommision;
profit=profit-sCommision;
  
//printing the details
cout<<"Total amount paid for stock purchase : "<<bTotal<<endl;
cout<<"Amount paid for Broker for stock purchase : "<<bCommision<<endl;
cout<<"Amount after selling the stock : "<<sTotal<<endl;
cout<<"Profit : "<<profit;
  
}


Related Solutions

Design a program (in C++)to calculate the stock purchasing and selling transactions. 1. ask the user...
Design a program (in C++)to calculate the stock purchasing and selling transactions. 1. ask the user to enter the name of the stock purchased, the number of share purchased, and the price per share purchased 2. assume the buyer pays 2% of the amount he paid for the stock purchase as broker commission 3. assume that the buyer sold all stocks. Ask the user to enter the price per share sold. 4. assume the buyer will pay another 2% of...
IN C++ LANGUAGE PLEASE::: Design and implement a program (name it Rectangle) to calculate and display...
IN C++ LANGUAGE PLEASE::: Design and implement a program (name it Rectangle) to calculate and display the area and perimeter of a rectangle with width = 4 and height = 8.
Design and implement a C++ program with functions to calculate the pre-tax charge: If the customer...
Design and implement a C++ program with functions to calculate the pre-tax charge: If the customer subscribes to a phone plan called Plan200, then he is charged $5 for the first 200 minutes. For each additional minutes, the customer will be charged $0.10. If the customer subscribes to a phone plan called Max20, then he is charged $0.05 for each minute up to $20. (I.e., the customer never needs to pay more than $20.) If the customer is not subscribed...
I. Design the C++ code for a program which will use the Pythagorean Theroem to calculate...
I. Design the C++ code for a program which will use the Pythagorean Theroem to calculate and display the length of a right triangle hypotenuse,c, given the lengths of its adjacent sides: a and b.. (hint: a^2 + b^2 = c^2) II. Design the C++ code for a program which will calculate and display the roots of a quadratic equation of the form ax^2 + bx + c = 0, given its coefficients, a, b, and c.
Design a program that will ask the user to input two integer numbers and then perform...
Design a program that will ask the user to input two integer numbers and then perform the basic arithmetic operations such as addition and subtraction. Each calculation is done by a separate function. The main function gets the input from the user, then calls the addition function and the subtraction function one at a time to perform the calculations. Each calculation function (addition or subtraction function) performs an arithmetic operation and then returns the calculation results back to where it...
C LANGUAGE Ask user how many scores there are, then ask for each score. Then calculate...
C LANGUAGE Ask user how many scores there are, then ask for each score. Then calculate the average score and scores below 60. Then display the average score and number of scores below 60
Write a C program that calculates a student grade in the C Programming Class. Ask the...
Write a C program that calculates a student grade in the C Programming Class. Ask the user to enter the grades for each one of the assignments completed in class: Quiz #1 - 25 points Quiz #2 - 50 points Quiz #3 - 30 points Project #1 - 100 points Project #2 - 100 points Final Test - 100 points The total of the quizzes count for a 30% of the total grade, the total of the projects counts for...
C++ In this lab, you will ask the user to design a leaning pyramid. The pyramid...
C++ In this lab, you will ask the user to design a leaning pyramid. The pyramid will either lean left or right. Start by asking the user how tall they want the pyramid to be. Then ask the user if they want the pyramid to lean left or right. You should then display a pyramid that meets the requirements. (See below for examples). YOU MUST use nested loops for your solution for ANY credit. Sample Run #1: Enter a pyramid...
Task Ltd. has the following transactions in purchasing and selling the ordinary shares of Sugar Company:...
Task Ltd. has the following transactions in purchasing and selling the ordinary shares of Sugar Company: 15. Jul. 2018          Purchased 12,000 shares of Sugar Company @ $100 per share. 31. Dec. 2018         The fair value of the ordinary shares of Sugar Company is $160 per share. 15. Jan. 2019         Sold the 4,000 ordinary shares of Sugar Company @ $150 per share. Required: Task Ltd. classifies the investment in the ordinary shares of Sugar Company as financial assets at fair value...
Create a C++ program that will ask the user for how many test scores will be...
Create a C++ program that will ask the user for how many test scores will be entered. Setup a while loop with this loop iteration parameter. (no fstream) The data needs to include the student’s first name, student number test score the fields should be displayed with a total width of 15. The prompt should be printed with a header in the file explaining what each is: ex. First Name student number Test Score 1) mike 6456464   98 2) phill...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT