Advertisement
Guest User

Untitled

a guest
Dec 16th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.28 KB | None | 0 0
  1. Module Module1
  2. 'This is where i am declaring the variables and assigning data types to them variables
  3. Dim hoursworked As Integer
  4. Dim hourlypay As Decimal
  5. Dim grosspay As Decimal
  6. Dim choice As String
  7. Dim charityincome As Single
  8. '######################################################
  9. Sub Main()
  10. Do 'This is the beginning of my loop
  11. getinput() 'Calls upon my procedure where i get the inputs from the user
  12. calcwage() 'Calls upon the calculations from the input of the user
  13. displaywages() 'Outputs the calculation answers in a suitable display
  14.  
  15. Loop Until choice = "no" 'This is the end of the loop of the user decideds to type no it will end
  16. End Sub
  17. '######################################################
  18. Sub getinput() 'This is the name of the procedure
  19. Console.WriteLine("Enter your hours worked") 'This is what will be displayer for the user
  20. hoursworked = Console.ReadLine() 'User input will be stored to this variable
  21. Console.WriteLine("Enter your hourly pay rate")
  22. hourlypay = Console.ReadLine()
  23.  
  24. End Sub 'End subroutine
  25.  
  26. '######################################################
  27. Sub calcwage() 'This is the name of the procedure
  28. grosspay = hoursworked * hourlypay 'The variable "grosspay" will be assigned to the calculation of the other two variables
  29. charityincome = (grosspay - 100) * 0.1
  30. End Sub
  31.  
  32. '######################################################
  33. Sub displaywages() 'This is the name of the procedure
  34. Console.WriteLine("Your gross wage is £" & grosspay) 'This will be outputted at the end for the user to see
  35. If grosspay >= 100 Then 'Initiated the selection loop if it is more than or equal to 100 then it will procede to do the next task
  36. Console.WriteLine("Your charity donation is £" & charityincome) 'Will output this is "grosspay" is more than or equal to 100
  37. End If 'Ends the IF statement loop
  38. Console.WriteLine("Would you like to perform another calculation? Type 'yes' or 'no' ") 'Asks the user with an output if they want to continute
  39. choice = Console.ReadLine() 'The variable is assigned to the input answer of the user
  40. End Sub
  41.  
  42. End Module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement