Question
Please do in Python3 IDE Stock Transaction Program Last month Joe purchased some stock from StockTrade. 1. Write a function(s) to allow the user to
Please do in Python3 IDE
Stock Transaction Program Last month Joe purchased some stock from StockTrade.
1. Write a function(s) to allow the user to input the followings:
The name of the stock
Number of shares Joe bought
Stock purchase price
Stock selling price
Broker commission
2. Write function(s) to calculate: and:
The amount of money Joe paid for the stock (number of shares bought * purchase price)
The amount of commission Joe paid his broker when he bought the stock. (Amount he paid for stocks * commission in percent)
The amount that Jim sold the stock for. (number of shares * selling price)
The amount of commission Joe paid his broker when he sold the stock. (Amount he sold shares * commission in percent)
Calculate the amount of money Joe had left when he sold the stock and paid his broker (both times). If this amount is positive, then Joe made a profit. If the amount is negative, then Jim lost money. Profit/loss =(amount paid to buy stocks + commission) (amount for sold stocks commission)
3. Write function(s) to display the following paid for the stock(s) that Joe had transacted ( if Joe entered 5 sets of stocks transactions then output 5 sets of stocks).
The Name of the Stock
The amount of money Joe paid for the stock (number of shares bought * purchase price)
The amount of commission Joe paid his broker when he bought the stock. (Amount he paid for stocks * commission in percent)
The amount that Jim sold the stock for. (number of shares * selling price)
The amount of commission Joe paid his broker when he sold the stock. (Amount he sold shares * commission in percent)
Display the amount of money Joe had left when he sold the stock and paid his broker (both times). If this amount is positive, then Joe made a profit. If the amount is negative, then Jim lost money. Profit/loss =(amount paid to buy stocks + commission) (amount for sold stocks commission)
4. Write the main() function to call the above functions. For all your functions you must include type annotations.
You should also allow the user to enter as many stocks as he/she wants or not to enter any stock at all.
(for this hw have at least 5 test cases) Example of type annotation for multiple return values
; def function(var1:int, var2:int, var3:int)->( str, float)
Some codes that do something
pass # a function can exist with no codes if you include pass as a line of code
return strvar1, floatvar2 # this line is just to demonstrate the return values, # not required if you have pass above.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started