for our class R - squared can be treated as a Please do with Python Program Set
ID: 3742515 • Letter: F
Question
for our class R - squared can be treated as aPlease do with Python
Program Set 3 (10 Points Stock Transaction Program Last month Kool Doode purchased some stock from Kaplack, Inc. Write a program that ask the user to input the followings: Number of shares Kool Doode bought Stock purchase price Stock selling price Broker commission 1. 2. 3. 4. displays the following paid for the stock. 1. The amount of money Kool Doode paid for the stock (number of shares bought purchase price) 2. The amount of commission Kool Doode paid his broker when he bought the stock. (Amount he paid for 3. The amount that Kool Doode sold the stock for. (number of shares selling price) stocks commission in percent) The amount of commission Kool Doode paid his broker when he sold the stock. (Amount he sold shares commission in percent) Display the amount of money Kool Doode had left when he sold the stock and paid his broker (both times). If this amount is positive, then Kool Doode made a profit. If the amount is negative, then Kool Doode lost money Profitloss (amount for sold stocks- commission) - (amount paid to buy stocks+commission) 4. 5. This is how the display or printout should look like: These are the input you see when you run your program. User input data after the colon: Enter Stock name Kaplack, Inc Enter Number of shares: 10000 Enter Purchase price : 33.92 Enter selling price: 35.92 Enter Commission:0.04
Explanation / Answer
ScreenShot
---------------------------------------------------------
Program
#User prompt to input values
stock_name=input("Enter Stock name: ")
num_of_shares=int(input("Enter Number of shares: "))
purchase_price=float(input("Enter Purchase price: "))
selling_price=float(input("Enter Selling price: "))
commission=float(input("Enter Commision: "))
#Calculations
purchasePrice=num_of_shares*purchase_price
pCommision=purchasePrice*commission
salePrice=selling_price*num_of_shares
sCommission=salePrice*commission
pORl=(salePrice-sCommission)-(purchasePrice+pCommision)
#Output Display
print(" Stock Name: "+stock_name+" ")
print("Amount paid for the stock : $ "+str(purchasePrice))
print("Commission paid for the purchase: $ "+str(pCommision))
print("Amount the stock sold for : $ "+str(salePrice))
print("Commission paid on the sale : $ "+str(sCommission))
print("Profit(or loss if negative) : $ "+str(pORl))
----------------------------------------------------------------------------
Output
Enter Stock name: Kaplac,. Inc.
Enter Number of shares: 10000
Enter Purchase price: 33.92
Enter Selling price: 35.92
Enter Commision: 0.04
Stock Name: Kaplac,. Inc.
Amount paid for the stock : $ 339200.0
Commission paid for the purchase: $ 13568.0
Amount the stock sold for : $ 359200.0
Commission paid on the sale : $ 14368.0
Profit(or loss if negative) : $ -7936.0
Press any key to continue . . .
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.