Advertisement
Guest User

Untitled

a guest
May 19th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. Module Module1
  2. Const startingCash As Integer = 750
  3. Dim buyingPri As Integer
  4. Dim sellingPri As Integer
  5. Dim noOfStocks As Single
  6. Dim remainder As Integer
  7. Dim profit As Integer
  8. Dim cashatend As Integer
  9. Sub Main()
  10. buyingPri = 0
  11. sellingPri = 0
  12. noOfStocks = 0
  13. remainder = 0
  14. profit = 0
  15. cashatend = 0
  16. Do
  17. Console.Write("Enter the buying price of stock: ")
  18. buyingPri = Console.ReadLine
  19. Console.Write("Enter Selling price: ")
  20. sellingPri = Console.ReadLine
  21.  
  22. 'calc
  23. noOfStocks = startingCash \ buyingPri
  24. remainder = startingCash Mod buyingPri
  25. profit = ((noOfStocks * sellingPri) + remainder)
  26. profit = profit - startingCash
  27. cashatend = ((noOfStocks * sellingPri) + remainder)
  28.  
  29. 'end result
  30. Console.WriteLine()
  31. Console.WriteLine("Bought " & noOfStocks & " shares at " & buyingPri & ".")
  32. Console.WriteLine("Sold at " & sellingPri & " for a profit of £" & profit)
  33. Console.WriteLine()
  34. Console.WriteLine("You are left with £" & cashatend)
  35. Console.WriteLine()
  36. Loop
  37. Console.ReadLine()
  38. End Sub
  39.  
  40. End Module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement