Guest User

Untitled

a guest
Nov 23rd, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.26 KB | None | 0 0
  1. ##StockThing.py
  2. #Made by David Hunt
  3.  
  4. #PsuedoCode:
  5. #int buyNumShares, buyPricePerShare, soldShares, soldPricePerShare, sbComm
  6. #int amountPayedForShares = buyNumShares * buyPricePerShare
  7. #int amountOfCommission = amountPayedForShares * sbComm
  8. #int totalMoneyPayed =  amountPayedForShares + amountOfCommission
  9. #Display ("Joe payed a total of $" ,  amountPayedForShares, " for the shares")
  10. #Display ("Joe payed his stockbroker $",amountOfCommission, " for the buying commision")
  11. #Display ("Joe payed a total of $", totalMoneyPayed, " for this transaction.")
  12. #Display () - Blank space for output format
  13. #int soldAmount = soldShares * soldPricePerShare
  14. #int amountOfCommission = soldAmount * sbComm
  15. #int totalMoneySold = soldAmount - amountOfCommission
  16. #Display ("Joe sold his stock for $", soldAmount, " two weeks later.")
  17. #Display ("Joe payed his stockbroker $",amountOfCommission, " for the selling commision")
  18. #Display ("Joe sold his shares for ", totalMoneySold, " including the stockbroker commission")
  19. #Display ()
  20. #int amountMadeLost = (totalMoneySold - totalMoneyPayed)
  21.  
  22. #if amountMadeLost > 0
  23.    # print ("Joe earned a total of $", amountMadeLost ," from selling his shares and taking out the commision of the stockbroker.")
  24. #elseif amountMadeLost is 0
  25.    # print ("Joe did not lose nor make anything. Hey, at least he didn't lose anything!")
  26. #else
  27.     #print ("Joe lost a total of $", amountMadeLost ," from selling his shares and taking out the commision of the stockbroker.")
  28.  
  29. ########################################
  30.  
  31. ##The ability to alter any values to change resuls is in place.
  32. #Amount and the price per share when he buys
  33. buyNumShares = 1000
  34. buyPricePerShare = 32.87
  35.  
  36.  
  37. #Amount and the price per share when he sells
  38. soldShares = 1000
  39. soldPricePerShare = 33.92
  40.  
  41. #stockbroker commision
  42. sbComm = 0.02
  43.  
  44.  
  45. ##determine and print the amount joe payed
  46. amountPayedForShares = buyNumShares * buyPricePerShare
  47. amountOfCommission = amountPayedForShares * sbComm
  48. totalMoneyPayed =  amountPayedForShares + amountOfCommission
  49.  
  50. ##Print results
  51. print ("Joe payed a total of $" ,  amountPayedForShares, " for the shares")
  52. print ("Joe payed his stockbroker $",amountOfCommission, " for the buying commision")
  53. print ("Joe payed a total of $", totalMoneyPayed, " for this transaction.")
  54. print ()
  55.  
  56. ##determine and print amount joe made
  57. soldAmount = soldShares * soldPricePerShare
  58. amountOfCommission = soldAmount * sbComm
  59. totalMoneySold = soldAmount - amountOfCommission
  60.  
  61. ##Print results
  62. print ("Joe sold his stock for $", soldAmount, " two weeks later.")
  63. print ("Joe payed his stockbroker $",amountOfCommission, " for the selling commision")
  64. print ("Joe sold his shares for ", totalMoneySold, " including the stockbroker commission")
  65. print ()
  66.  
  67. #Determine the amount he made and if it is positive or not
  68. amountMadeLost = (totalMoneySold - totalMoneyPayed)
  69.  
  70. ##Display results
  71. if amountMadeLost > 0:
  72.     print ("Joe earned a total of $", amountMadeLost ," from selling his shares and taking out the commision of the stockbroker.")
  73. elif amountMadeLost == 0 :
  74.     print ("Joe did not lose nor make anything. Hey, at least he didn't lose anything!")
  75. else :
  76.     print ("Joe lost a total of $", amountMadeLost ," from selling his shares and taking out the commision of the stockbroker.")
Add Comment
Please, Sign In to add comment