CODE
Imports Microsoft.VisualBasic
Public Class Management
Implements Final.IPayCheck
Private _benefitCode As String
Private _taxCategoryId As String
Private _benefitCost As Decimal
Private _hoursWorked As Decimal
Private _hourlySalary As Decimal
Public Property benefitCode() As String Implements Final.IPayCheck.benefitCode
Get
Return Me._benefitCode
End Get
Set(ByVal value As String)
Me._benefitCode = value
End Set
End Property
Public Function getGrossWeeklySalary() As Decimal Implements Final.IPayCheck.getGrossWeeklySalary
Dim grossPaycheck As Decimal
grossPaycheck = Me._hoursWorked * Me._hourlySalary
Return grossPaycheck
End Function
Public Function getNetWeeklySalary() As Decimal Implements Final.IPayCheck.getNetWeeklySalary
Dim currentBenefitCost As Decimal
Dim grossSalary As Decimal
grossSalary = Me.getGrossWeeklySalary()
If _benefitCode = "A" Then
currentBenefitCost = (10000 / 12) * 0.05 / 4
ElseIf _benefitCode = "B" Then
currentBenefitCost = (15000 / 12) * 0.05 / 4
ElseIf _benefitCode = "C" Then
currentBenefitCost = (20000 / 12) * 0.05 / 4
ElseIf _benefitCode = "D" Then
currentBenefitCost = (25000 / 12) * 0.05 / 4
ElseIf _benefitCode = "F" Then
currentBenefitCost = (30000 / 12) * 0.05 / 4
End If
' tax logic
'Dim netSalary = grossSalary - currentBenefitCost ') - Tax
Dim grossSalary1 As Decimal
grossSalary1 = Me.getNetWeeklySalary
'Dim grossSalary1 As Decimal
Dim Tax As Decimal
Dim T1 As Decimal
Dim T2 As Decimal
Dim T3 As Decimal
Dim T4 As Decimal
grossSalary1 = grossSalary - currentBenefitCost
If T1 <= 500 Then
Tax = (grossSalary1 * 0.05)
ElseIf T2 <= 1000 Then
Tax = (grossSalary1 * 0.1)
ElseIf T3 <= 2000 Then
Tax = (grossSalary1 * 0.3)
ElseIf T4 <= 20000 Then
Tax = (grossSalary1 * 0.35)
End If
Dim netSalary = grossSalary1 - Tax
Return netSalary
End Function
Public Function getOvertimePay() As Decimal Implements Final.IPayCheck.getOvertimePay
Return 0
End Function
Public Property hourlySalary() As Decimal Implements Final.IPayCheck.hourlySalary
Get
Return Me._hourlySalary
End Get
Set(ByVal value As Decimal)
Me._hourlySalary = value
End Set
End Property
Public Property hoursWorked() As Long Implements Final.IPayCheck.hoursWorked
Get
Return Me._hourlySalary
End Get
Set(ByVal value As Long)
Me._hoursWorked = value
End Set
End Property
End Class