Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Stock Transaction Objectives: Practice basic data types, expressions, and I/O. On June 6 Joe purchased some stock in ABC Corp. On June 13 Joe sold

Stock Transaction
Objectives:
Practice basic data types, expressions, and I/O.
On June 6 Joe purchased some stock in ABC Corp. On June 13 Joe sold all shares of the stock he purchased one week ago. There was no accrued dividend during the period.
Write aprogram to display the following information:
The amount of money Joe paid to buy the stock.
The amount of commission Joe paid to his broker when he bought the stock.
The amount of money that Joe sold the stock for.
The amount of commission Joe paid to his broker when he sold the stock.
The net profit from the two transactions. Note that this amount could be positive or negative.
The program will prompt Joe for the number of shares, the share price (i.e., price per share) he paid on June 6, and the share price (i.e., price per share) he sold on June 13. Then the program performs calculations needed to display the desired information.
The commission Joe paid to his stockbroker is 3 percent of the amount he paid for the stock. When Joe sold the stock, he paid another commission amounting to 2 percent of the amount he received for the stock.
User interface specifications:
Input
o At the start, the program should display a brief description of what it will do.
o The program then prompts for the three inputs, making sure that the units of input are
clear to the user. The three inputs must be in the order of (1) number of shares purchased, (2) the purchase share price, and (3) the sell share price. Share price means price per share.
Output
o Display the results (i.e., the above listed five items)
Code specifications:
Include header comments at the top of the file that have the name of the script file you submitted for grade, and a brief description of the program. The description should be one or 2 lines long describing the purpose of the program.
Include comments for each section: input, process, output
Include blank lines to separate main sections of the code
Use descriptive variable names
Testing:
Develop at least 2 test cases, calculate the correct results by hand, and then confirm that your program gives the same results. You do not need to submit your test cases.
Submission:
The name of submitted file must be in the following format: _yourfirstname.py

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

3. How would you address the problems that make up the situation?

Answered: 1 week ago

Question

2. What recommendations will you make to the city council?

Answered: 1 week ago