Question
I having difficulties in modifying this payroll solution so that it pays the employee time and one-half for any hours worked over 40. My solution
I having difficulties in modifying this payroll solution so that it pays the employee time and one-half for any hours worked over 40. My solution is below. I need the formula for the time and one-half pay in excess of 40.
Public Class frmMain Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click Me.Close() ' closes and exit the application
End Sub
Private Sub btnCalc_Click(sender As Object, e As EventArgs) Handles btnCalc.Click 'to calculate and display sun project employee's gross pay, taxes, and net pay
'to declare named constants
Const decFWT_RATE As Decimal = 0.2 Const decFICA_RATE As Decimal = 0.08 Const decSTATE_RATE As Decimal = 0.02
'to declare variables
Dim decHours As Decimal Dim decPayRate As Decimal Dim decGross As Decimal Dim decFwt As Decimal Dim decFica As Decimal Dim decState As Decimal Dim decNet As Decimal
'assign input values into the variables
Decimal.TryParse(txtHours.Text, decHours)
Decimal.TryParse(txtRate.Text, decPayRate)
'to fix the penny off error
decGross = Math.Round(decHours * decPayRate, 2) decFwt = Math.Round(decGross * decFWT_RATE, 2) decFica = Math.Round(decGross * decFICA_RATE, 2) decState = Math.Round(decGross * decSTATE_RATE, 2)
decNet = decGross - decFwt - decFica - decState
'format the gross and taxes outputs into two decimal places
lblGross.Text = decGross.ToString("N2") lblFWT.Text = decFwt.ToString("N2") lblFICA.Text = decFica.ToString("N2") lblState.Text = decState.ToString("N2")
'format the net pay output into usd currency and two decimal places
lblNet.Text = decNet.ToString("C2") End Sub
Private Sub Label4_Click(sender As Object, e As EventArgs) Handles Label4.Click
End Sub End Class
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started