This code calculates an employee's pay based on their hours worked and hourly rate, applying overtime rates if hours exceed 40 and deducting taxes if applicable. It gets the employee's hours and rate, calculates regular and overtime pay separately, applies a 18% tax deduction if required, and displays the final pay amount based on whether overtime was worked and if taxes were deducted.
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
89 views
Exercise 2 Word
This code calculates an employee's pay based on their hours worked and hourly rate, applying overtime rates if hours exceed 40 and deducting taxes if applicable. It gets the employee's hours and rate, calculates regular and overtime pay separately, applies a 18% tax deduction if required, and displays the final pay amount based on whether overtime was worked and if taxes were deducted.
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1
Public Class Form1
Dim time As Decimal
Dim rates As Decimal Dim answer As String Dim answer2 As String Dim tax1 As Decimal Dim tax2 As Decimal Private Sub pay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles pay.Click time = txthours.Text rates = txtrate.Text answer = time * rates * 2.5 answer2 = time * rates tax1 = answer * 0.18 tax2 = answer2 * 0.18 If Yes.Checked Then MessageBox.Show("NO TAXES DEDUCTED") If time > 40 Then Money.Text = time * rates * 2.5 ElseIf time <= 40 Then Money.Text = time * rates End If ElseIf No.Checked Then If time > 40 Then Money.Text = answer - tax1 ElseIf time <= 40 Then Money.Text = answer2 - tax2 End If End If End Sub End Class