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)

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter2: Using Data
Section: Chapter Questions
Problem 2CP
icon
Related questions
Question

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)

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Concept of Parenthesis
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning