Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The Social Security of FICA tax has two components – The Social Security Benefit

ID: 3664091 • Letter: T

Question

The Social Security of FICA tax has two components – The Social Security Benefits Tax, which in 2015 is 6.2 percent on the first $102,000 of earnings for the year, and the Medicare tax, which is 1.45 percent of earnings. The following program should calculate and employee’s FICA tax for the current pay period.

I'm wondering what the code should be, as the first textbox should enable the person to enter the total earnings prior to the current pay period, the second textboxshould allow earnings for the current pay year which all of that should calculate the FICA taxes for the current year.

visual basic

Explanation / Answer

Public Class form1
Private Sub Display_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDisplay.Click
Dim empName As String = " " 'Name of employee
Dim hrWage As Double 'Hourly wage
Dim hrsWorked As Double 'Hours worked this week
Dim allowances As Integer 'Number of withholding allowances for employee
Dim mStatus As String = " " 'Marital status: S - Single; M - Married
Dim prevPay As Double 'Total pay for year excluding this week
Dim pay As Double 'This week's pay before taxes
Dim totalPay As Double 'Total pay for year including this week
Dim ficaTax As Double 'FICA taxes for this week
Dim fedTax As Double 'Federal income tax withheld this week
Dim check As Double 'Paycheck this week

InputData(empName, hrWage, hrsWorked, allowances, mStatus, prevPay) 'Task 0
pay = Gross_Pay(hrWage, hrsWorked) 'Task 1
totalPay = Total_pay(prevPay, pay) 'Task 2
ficaTax = FICA_Tax(pay, prevPay, totalPay) 'Task 3
fedTax = Fed_Tax(pay, allowances, mStatus) 'Task 4
check = Net_Check(pay, ficaTax, fedTax) 'Task 5
ShowPayroll(empName, pay, totalPay, ficaTax, fedTax, check) 'Task 6
End Sub

Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNext.Click
'Clear all text boxes for next employee's data
txtName.Clear()
txtWage.Clear()
txtHours.Clear()
txtAllowances.Clear()
mtxtMarital.Clear()
txtPriorPay.Clear()
Results.Items.Clear()

End Sub
Private Sub btnQuit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnQuit.Click
End
End Sub

Sub InputData(ByRef empName As String, ByRef hrWage As Double, ByRef hrsWorked As Double, ByRef allowances As Integer, ByRef mStatus As String, ByRef prevPay As Double)
Dim pay As Double
Dim Rate As Double
empName = txtName.Text
hrWage = CDbl(txtHours.Text)
allowances = CInt(txtAllowances.Text)
mStatus = mtxtMarital.Text.ToUpper.Substring(0, 1) 'M or S
prevPay = CDbl(txtPriorPay.Text)
pay = Gross_Pay(hrWage, hrsWorked)
If empName <> " " Then
If IsNumeric(txtHours.Text) Then
If hrsWorked >= 4 And hrsWorked <= 60 Then
If IsNumeric(pay) Then
If pay >= 8 And pay <= 40 Then
If Rate = 15 Or Rate = 18 Then
If hrsWorked <= 40 Then
txtName.Text = empName

Else
MsgBox("")
End If
Else
MsgBox("Please Enter 15 or 18")
End If
Else
MsgBox("Please enter pay rate between 8 and 40")
End If
Else
MsgBox("Please enter a numeric value")
End If
Else
MsgBox("Please enter value between 4 and 60 ")
End If
Else
MsgBox("Please enter number of hours worked")
End If
Else
MsgBox("Please enter Employee name")
End If
End Sub

Function Gross_Pay(ByVal hrWage As Double, ByVal hrsWorked As Double) As Double
'Task 1: Compute weekly pay before taxes
If hrsWorked <= 40 Then
Return hrsWorked * hrWage
Else
Return 40 * hrWage + (hrsWorked - 40) * 1.5 * hrWage
End If
If hrsWorked >= 60 Then
MessageBox.Show(" Please enter valied number of hours.")
End If

End Function

Function Total_pay(ByVal prevPay As Double, ByVal pay As Double) As Double
'Task 2: Compute total pay before taxes
Return prevPay + pay
End Function

Function FICA_Tax(ByVal pay As Double, ByVal prevPay As Double, ByVal totalPay As Double) As Double
'Task 3: Compute social security and medicare tax
Dim socialSecurity As Double 'Social Security tax for this week
Dim medicare As Double 'Medicare tax for this week
Dim sum As Double 'Sum of above two taxes
If totalPay <= 102000 Then
socialSecurity = 0.062 * pay
ElseIf prevPay < 102000 Then
socialSecurity = 0.062 * (102000 - prevPay)
End If
medicare = 0.0145 * pay
sum = socialSecurity + medicare
Return Math.Round(sum, 2) 'Round to nearest cent
End Function

Function Fed_Tax(ByVal pay As Double, ByVal allowances As Integer, ByVal mStatus As String) As Double
'Task 4.1: Compute federal income tax rounded to two decimal places
Dim adjPay As Double
Dim tax As Double 'Unrounded federal tax
adjPay = pay - (67.31 * allowances)
If adjPay < 0 Then
adjPay = 0
End If
If mStatus = "S" Then
tax = TaxSingle(adjPay)
Else
tax = TaxMarried(adjPay)
End If
Return Math.Round(tax, 2)
End Function

Function TaxSingle(ByVal adjPay As Double) As Double
'Task 4.2: Compute federal tax withheld for single person
Select Case adjpay
Case 0 To 51
Return 0
Case 51 To 198
Return 0.1 * (adjPay - 51)
Case 198 To 653
Return 14.7 + 0.15 * (adjPay - 198)
Case 653 To 1533
Return 82.95 + 0.25 * (adjPay - 653)
Case 1533 To 3202
Return 302.95 + 0.28 * (adjPay - 1533)
Case 3202 To 6916
Return 720.27 + 0.33 * (adjPay - 3202)
Case Is > 6916
Return 1995.89 + 0.35 * (adjPay - 6916)
End Select
End Function

Function TaxMarried(ByVal adjPay As Double) As Double
'Task 4.3: Compute federal tax withheld for married person
Select Case adjPay
Case 0 To 154
Return 0
Case 154 To 453
Return 0.1 * (adjPay - 154)
Case 453 To 1388
Return 29.9 + 0.15 * (adjPay - 453)
Case 1388 To 2651
Return 170.15 + 0.25 * (adjPay - 1388)
Case 2651 To 3994
Return 485.9 + 0.28 * (adjPay - 2651)
Case 3994 To 7021
Return 861.94 + 0.33 * (adjPay - 3202)
Case Is > 7021
Return 1860.85 + 0.35 * (adjPay - 7021)
End Select
End Function

Function Net_Check(ByVal pay As Double, ByVal ficaTax As Double, ByVal fedTax As Double) As Double
'Task 5: Compute amount of money given to employee
Return pay - ficaTax - fedTax
End Function

Sub ShowPayroll(ByVal empName As String, ByVal pay As Double, ByVal totalPay As Double, ByVal ficaTax As Double, ByVal fedTax As Double, ByVal check As Double)
'Task 6: Display results of payroll computations
Dim fmtStr As String = "{0,24} {1,-10:C}"
Results.Items.Clear()
Results.Items.Add("Payroll results for " & empName)
Results.Items.Add("")
Results.Items.Add(String.Format(fmtStr, "Gross pay this preiod:", pay))
Results.Items.Add("")
Results.Items.Add(String.Format(fmtStr, "Year-to-date earnings:", totalPay))
Results.Items.Add("")
Results.Items.Add(String.Format(fmtStr, "Fica Taxes this period:", ficaTax))
Results.Items.Add("")
Results.Items.Add(String.Format(fmtStr, "Income TAX withheld:", fedTax))
Results.Items.Add("")
Results.Items.Add(String.Format(fmtStr, "Net pay (chack amount):", check))
End Sub

Private Sub form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub
End Class

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote