Advertisement
gazmull

CS-101018 Calculator Class

Oct 14th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Public Class Calculator
  2.  
  3.     Dim RateHour As Decimal
  4.     Dim HourDay As Decimal
  5.     Dim NumberOfDaysWork As Integer
  6.  
  7.     ' Constructor to pass the user-input values to the current instance
  8.    ' `Dim Calc As New Calculator(blah blah, buh, baaaaaaaah)`
  9.    Public Sub New(ByVal RH As Decimal, ByVal HD As Decimal, ByVal NDW As Integer)
  10.         RateHour = RH
  11.         HourDay = HD
  12.         NumberOfDaysWork = NDW
  13.     End Sub
  14.  
  15.     Public Function GetGrossSalary()
  16.         Return (RateHour * HourDay) * NumberOfDaysWork
  17.     End Function
  18.  
  19.     ' Percentage: TMW, PH, or SSS
  20.    ' Abbreviations explained below
  21.    Public Function GetDeduction(ByVal Percentage As Decimal)
  22.         Return GetGrossSalary() * Percentage
  23.     End Function
  24.  
  25.     ' TMW = Tax of Monthly Wages
  26.    ' PH = PhilHealth
  27.    ' SSS = Social Security System
  28.  
  29.     ' Summation of calculated deductions
  30.    Public Function GetTotalDeduction(ByVal TMW As Decimal, ByVal PH As Decimal, ByVal SSS As Decimal)
  31.         Return TMW + PH + SSS
  32.     End Function
  33.  
  34.     Public Function GetNetSalary(ByVal TMW As Decimal, ByVal PH As Decimal, ByVal SSS As Decimal)
  35.         Return GetGrossSalary() - GetTotalDeduction(TMW, PH, SSS)
  36.     End Function
  37. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement