Problem Statement for Stock Transaction Program George uses the services of a brokerage firm to buy and sell stocks. Each time he buys or sells a block of stocks, he must pay the brokerage firm a commission of 1.5% per share.Design a program that allows George to enter the number of shares in the block, the price per share when he bought the block and the price per share when he sold the block. The program should display the amount of money he paid to buy the stock and the amount of the commission. The amount of money he made when he sold the stock and the amount of the commission, the amount of profit (or loss) he madeafter paying for the purchase cost and both commissions. There are three user inputs for this problem: the number of shares in the block, the price per share when the block was bought, the price per share when the block was sold. There is one constant: the percentage of the commission (1.5%) The amount to buy the stock is: number of shares in block * purchase price per shareThe commission for the purchase is: the amount spent * commission percentage/100The amount received when the stock was sold is: number of shares * selling price per shareThe commission for the sale is: the amount received * commission percentage / 100The profit would be: amount received -(amount spent + commission for purchase + commission for sale) Asa test case assume that George bought a block of 1000 shares of a stock at $25.63 per share. Six months later, he sold the block of 1000 shares for $31.27 per share. The amount spent to buy is 1000 * 25.63 =25630The commission on the purchase is 25630 * .015 = 384.45The amount received when sold is 1000 * 31.27 = 31270The commission on the sale is 31270 * .015 = 469.05The amount of profit George received is 31270 -(25630 + 384.45 + 469.05) = 4786.5 (PYTHON)
Problem Statement for Stock Transaction Program
George uses the services of a brokerage firm to buy and sell stocks. Each time he buys or sells a block of stocks, he must pay the brokerage firm a commission of 1.5% per share.Design a program that allows George to enter the number of shares in the block, the price per share when he bought the block and the price per share when he sold the block. The program should display the amount of money he paid to buy the stock and the amount of the commission. The amount of money he made when he sold the stock and the amount of the commission, the amount of profit (or loss) he madeafter paying for the purchase cost and both commissions.
There are three user inputs for this problem: the number of shares in the block, the price per share when the block was bought, the price per share when the block was sold.
There is one constant: the percentage of the commission (1.5%)
The amount to buy the stock is: number of shares in block * purchase price per shareThe commission for the purchase is: the amount spent * commission percentage/100The amount received when the stock was sold is: number of shares * selling price per shareThe commission for the sale is: the amount received * commission percentage / 100The profit would be: amount received -(amount spent + commission for purchase + commission for sale)
Asa test case assume that George bought a block of 1000 shares of a stock at $25.63 per share. Six months later, he sold the block of 1000 shares for $31.27 per share.
The amount spent to buy is 1000 * 25.63 =25630The commission on the purchase is 25630 * .015 = 384.45The amount received when sold is 1000 * 31.27 = 31270The commission on the sale is 31270 * .015 = 469.05The amount of profit George received is 31270 -(25630 + 384.45 + 469.05) = 4786.5
(PYTHON)
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images