Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Module Module1
- Const startingCash As Integer = 750
- Dim buyingPri As Integer
- Dim sellingPri As Integer
- Dim noOfStocks As Single
- Dim remainder As Integer
- Dim profit As Integer
- Dim cashatend As Integer
- Sub Main()
- buyingPri = 0
- sellingPri = 0
- noOfStocks = 0
- remainder = 0
- profit = 0
- cashatend = 0
- Do
- Console.Write("Enter the buying price of stock: ")
- buyingPri = Console.ReadLine
- Console.Write("Enter Selling price: ")
- sellingPri = Console.ReadLine
- 'calc
- noOfStocks = startingCash \ buyingPri
- remainder = startingCash Mod buyingPri
- profit = ((noOfStocks * sellingPri) + remainder)
- profit = profit - startingCash
- cashatend = ((noOfStocks * sellingPri) + remainder)
- 'end result
- Console.WriteLine()
- Console.WriteLine("Bought " & noOfStocks & " shares at " & buyingPri & ".")
- Console.WriteLine("Sold at " & sellingPri & " for a profit of £" & profit)
- Console.WriteLine()
- Console.WriteLine("You are left with £" & cashatend)
- Console.WriteLine()
- Loop
- Console.ReadLine()
- End Sub
- End Module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement