I am so confused where I am going wrong in my code!! Any help would be great. Pu
ID: 3659791 • Letter: I
Question
I am so confused where I am going wrong in my code!! Any help would be great. Public Class frmPayroll Private Sub btnSubmit_Click(sender As System.Object, e As System.EventArgs) Handles btnSubmit.Click 'declares names and reporting period Dim empName As String = (txtEmpNam.Text) Dim supName As String = (txtSupNam.Text) Dim repPeriod As String = (txtRepPeriod.Text) 'declares pay rates for hourly and overtime Dim otRate As Double Dim hrWage As Double 'declares the text boxes for the clients, contracts, and projects the employee is working on Dim client1 As String = (txtClient.Text) Dim client2 As String = (txtClient2.Text) Dim contract1 As String = (txtContract.Text) Dim contract2 As String = (txtContract2.Text) Dim projects1 As String = (txtProjects.Text) Dim projects2 As String = (txtProjects2.Text) 'declares the text boxes according to the amount of hours the employee has worked Dim monHrs1 As Double Dim monHrs2 As Double Dim tuesHrs1 As Double Dim tuesHrs2 As Double Dim wedHrs1 As Double Dim wedHrs2 As Double Dim thursHrs1 As Double Dim thursHrs2 As Double Dim friHrs1 As Double Dim friHrs2 As Double Dim satHrs1 As Double Dim satHrs2 As Double Dim sunHrs1 As Double Dim sunHrs2 As Double 'declares pay amount Dim pay As Double Dim regPay As Double Dim otPay As Double Dim chkdAmnt As Double 'declares totals Dim monTot As Double Dim tuesTot As Double Dim wedTot As Double Dim thursTot As Double Dim friTot As Double Dim satTot As Double Dim sunTot As Double Dim totals1 As Double Dim totals2 As Double Dim hrsWorked As Double 'declares when employee works less than 40 hours Dim under40 As String = (empName & " has worked less than fourty hours during week " & repPeriod & ".") If Not DataOK() Then Dim msg As String = "At least one piece of requested data is missing," & "or is provided improperly." MessageBox.Show(msg) Else InputData(empName, supName, repPeriod, client1, client2, contract1, contract2, projects1, projects2, monHrs1, monHrs2, tuesHrs1, tuesHrs2, wedHrs1, wedHrs2, thursHrs1, thursHrs2, friHrs1, friHrs2, satHrs1, satHrs2, sunHrs1, sunHrs2) pay = Gross_Pay(hrWage, hrsWorked, under40, otRate) regPay = Regular_Pay(hrWage, hrsWorked) otPay = Overtime_Pay(hrsWorked, otRate) chkdAmnt = Checked_Vaca() monTot = (monHrs1 + monHrs2) tuesTot = (tuesHrs1 + tuesHrs2) wedTot = (wedHrs1 + wedHrs2) thursTot = (thursHrs1 + thursHrs2) friTot = (friHrs1 + friHrs2) satTot = (satHrs1 + satHrs2) sunTot = (sunHrs1 + sunHrs2) totals1 = (monHrs1 + tuesHrs1 + wedHrs1 + thursHrs1 + friHrs1 + satHrs1 + sunHrs1) totals2 = (monHrs2 + tuesHrs2 + wedHrs2 + thursHrs2 + friHrs2 + satHrs2 + sunHrs2) hrsWorked = (totals1 + totals2) ShowTotals(empName, repPeriod, monTot, tuesTot, wedTot, thursTot, friTot, satTot, sunTot, totals1, totals2, hrsWorked) ShowUndr40(under40) ShowPayroll(empName, repPeriod, hrsWorked, hrWage, otRate, pay, regPay, otPay, chkdAmnt) End If End Sub Function DataOK() As Boolean Dim repPeriod = txtRepPeriod.Text Dim mon1 = txtMonday.Text Dim mon2 = txtMonday2.Text Dim tues1 = txtTuesday.Text Dim tues2 = txtTuesday2.Text Dim wed1 = txtWednesday1.Text Dim wed2 = txtWednesday2.Text Dim thurs1 = txtThursday1.Text Dim thurs2 = txtThursday2.Text Dim fri1 = txtFriday1.Text Dim fri2 = txtFriday2.Text Dim sat1 = txtSaturday1.Text Dim sat2 = txtSaturday2.Text Dim sun1 = txtSunday1.Text Dim sun2 = txtSunday2.Text 'Validate data If (txtEmpNam.Text = "") Or (txtSupNam.Text = "") Then MessageBox.Show("Please enter name.") End If If (Not repPeriod <= 52) Then MessageBox.Show("Please enter a valid reporting date.") 'Else ' If (Not IsNumeric(mon1)) And (Not IsNumeric(mon2)) And (Not chkMon.Checked) Then 'mon1 = 0 And mon2 = 0 And chkMon.Checked ' Else ' If (Not IsNumeric(tues1)) And (Not IsNumeric(tues2)) Or (tues1 = "") And (tues2 = "") And (Not chkTues.Checked) Then ' Else ' If (Not IsNumeric(wed1)) And (Not IsNumeric(wed2)) Or (wed1 = "") And (wed2 = "") And (Not chkWed.Checked) Then ' Else ' If (Not IsNumeric(thurs1)) And (Not IsNumeric(thurs2)) Or (thurs1 = "") And (thurs2 = "") And (Not chkThurs.Checked) Then ' Else ' If (Not IsNumeric(fri1)) And (Not IsNumeric(fri2)) Or (fri1 = "") And (fri2 = "") And (Not chkFri.Checked) Then ' Else ' If (Not IsNumeric(sat1)) And (Not IsNumeric(sat2)) Or (sat1 = "") And (sat2 = "") And (Not chkSat.Checked) Then ' Else ' If (Not IsNumeric(sun1)) And (Not IsNumeric(sun2)) Or (sun1 = "") And (sun2 = "") And (Not chkSun.Checked) Then Return False Else Return True ' End If 'End If ' End If 'End If ' End If ' End If 'End If End If Return DataOK End Function Sub InputData(ByRef empName As String, ByRef supName As String, ByVal repPeriod As Double, ByRef client1 As String, ByRef client2 As String, ByRef contract1 As String, ByRef contract2 As String, ByRef projects1 As String, ByRef projects2 As String, ByVal monhrs1 As Double, ByVal monhrs2 As Double, ByVal tueshrs1 As Double, ByVal tueshrs2 As Double, ByVal wedhrs1 As Double, ByVal wedhrs2 As Double, ByVal thurshrs1 As Double, ByVal thurshrs2 As Double, ByVal frihrs1 As Double, ByVal frihrs2 As Double, ByVal sathrs1 As Double, ByVal sathrs2 As Double, ByVal sunhrs1 As Double, ByVal sunhrs2 As Double) empName = (txtEmpNam.Text) supName = (txtSupNam.Text) repPeriod = (txtRepPeriod.Text) client1 = (txtClient.Text) client2 = (txtClient2.Text) contract1 = (txtContract.Text) contract2 = (txtContract2.Text) projects1 = (txtProjects.Text) projects2 = (txtProjects2.Text) txtMonday.Text = monhrs1 txtMonday2.Text = monhrs2 txtTuesday.Text = tueshrs1 txtTuesday2.Text = tueshrs2 txtWednesday1.Text = wedhrs1 txtWednesday2.Text = wedhrs2 txtThursday1.Text = thurshrs1 txtThursday2.Text = thurshrs2 txtFriday1.Text = frihrs1 txtFriday2.Text = frihrs2 txtSaturday1.Text = sathrs1 txtSaturday2.Text = sathrs2 txtSunday1.Text = sunhrs1 txtSunday2.Text = sunhrs2 End Sub Function Gross_Pay(ByVal hrwage As Double, ByVal hrsWorked As Double, ByRef under40 As String, ByVal otRate As Double) As Double Dim grsspay As Double Dim h As Double = 15 Dim w As Double Dim o As Double = 22.5 h = hrwage w = hrsWorked o = otRate If w < 40 Then grsspay = (h * w) Return grsspay Return under40 ElseIf w = 40 Then grsspay = (h * w) Return grsspay ElseIf hrsWorked > 40 Then grsspay = (40 * h + (w - 40) * o) Return grsspay End If Gross_Pay = grsspay Return Gross_Pay End Function Function Regular_Pay(ByVal hrWage As Double, ByVal hrsWorked As Integer) As Double Dim regpay As Double hrWage = (FormatCurrency(15, 2)) If hrsWorked <= 40 Then regpay = (hrWage * hrsWorked) Return regpay End If Regular_Pay = regpay Return Regular_Pay End Function Function Overtime_Pay(ByVal hrsworked As Integer, ByVal otRate As Double) As Double Dim otpay As Double otRate = (FormatCurrency(22.5, 2)) If hrsworked > 40 Then otpay = ((hrsworked - 40) * otRate) Return otpay End If Overtime_Pay = otpay Return Overtime_Pay End Function Function Checked_Vaca() Dim sum As Double = 0 If chkMon.Checked Then sum += 1 End If If chkTues.Checked Then sum += 1 End If If chkWed.Checked Then sum += 1 End If If chkThurs.Checked Then sum += 1 End If If chkFri.Checked Then sum += 1 End If If chkSat.Checked Then sum += 1 End If If chkSun.Checked Then sum += 1 End If Checked_Vaca = sum Return Checked_Vaca End Function Private Sub btnNextEmp_Click(sender As System.Object, e As System.EventArgs) Handles btnNextEmp.Click txtEmpNam.Clear() txtSupNam.Clear() txtRepPeriod.Clear() txtClient.Clear() txtClient2.Clear() txtContract.Clear() txtContract2.Clear() txtProjects.Clear() txtProjects2.Clear() txtMonday.Clear() txtMonday2.Clear() txtTuesday.Clear() txtTuesday2.Clear() txtWednesday1.Clear() txtWednesday2.Clear() txtThursday1.Clear() txtThursday2.Clear() txtFriday1.Clear() txtFriday2.Clear() txtSaturday1.Clear() txtSaturday2.Clear() txtSunday1.Clear() txtSunday2.Clear() txtMonTot.Clear() txtTuesTot.Clear() txtWedTot.Clear() txtThursTot.Clear() txtFriTot.Clear() txtSatTot.Clear() txtSunTot.Clear() lstPayroll.Items.Clear() End Sub Private Sub btnExit_Click(sender As System.Object, e As System.EventArgs) Handles btnExit.Click Me.Close() End Sub Public Sub ShowTotals(empName As String, repPeriod As String, monTot As Double, tuesTot As Double, wedTot As Double, thursTot As Double, friTot As Double, satTot As Double, sunTot As Double, totals1 As Double, totals2 As Double, hrsWorked As Double) txtMonTot.Text = monTot txtTuesTot.Text = tuesTot txtWedTot.Text = wedTot txtThursTot.Text = thursTot txtFriTot.Text = friTot txtSatTot.Text = satTot txtTotals.Text = totals1 txtTotals2.Text = totals2 txtWkTot.Text = hrsWorked End Sub Private Sub ShowUndr40(under40 As String) under40 = CStr(lblUnder40.Text) End Sub Private Sub ShowPayroll(empName As String, repPeriod As Double, hrsWorked As Double, hrWage As Double, otRate As Double, pay As Double, regPay As Double, otPay As Double, chkdAmnt As Double) lstPayroll.Items.Add("Payroll information for " & empName & " for the week ending in Week " & CDbl(repPeriod) & ":") lstPayroll.Items.Add("Total Hours Worked: " & hrsWorked) lstPayroll.Items.Add("Regular Hours Worked: " & hrsWorked = 40) lstPayroll.Items.Add("Rate per regular work hour: " & (FormatCurrency(hrWage, 2))) lstPayroll.Items.Add("Regular Hourly Pay: " & (FormatCurrency(regPay, 2))) lstPayroll.Items.Add(" ") lstPayroll.Items.Add("Overtime Hours Worked: " & 40 - hrsWorked) lstPayroll.Items.Add("Rate Per Overtime Work Hour: " & (FormatCurrency(otRate, 2))) lstPayroll.Items.Add("Overtime Pay: " & (FormatCurrency(otPay, 2))) lstPayroll.Items.Add("") lstPayroll.Items.Add("Gross Pay: " & (FormatCurrency(pay, 2))) lstPayroll.Items.Add("") lstPayroll.Items.Add("Number of Holiday/Weekend/Vacation Days Claimed: " & (FormatNumber(chkdAmnt, 0))) End Sub End ClassExplanation / Answer
its is a cmos program
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.