Project 1: Create an application that displays payroll information by: a. Drawin
ID: 3813795 • Letter: P
Question
Project 1: Create an application that displays payroll information by:
a. Drawing the flowchart for this application.
b. Write the code by using Visual Basic programming language.
Design your application to have the following characteristics:]
1. The application should allow the user to enter the following data for ten employees:
• Employee Id • Number of hours worked • Hourly pay rate • Percentage to be withheld for state income tax • Percentage to be withheld for federal income tax • Percentage to be withheld for The Federal Insurance Contributions Act (FICA)
2. The application should prevent the user entering information for more than ten employees
3. The application should calculate and display the following data for each employee (in a one list Box or in multiple list Boxes:
• Gross pay (the number of hours worked multiplied by the hourly pay rate)
• State income tax withholdings (gross pay multiplied by state income tax percentage)
• Federal income tax withholdings (gross pay multiplied by federal income tax percentage)
• FICA withholdings (gross pay multiplied by FICA income tax percentage)
• Net pay (the gross pay minus state income tax, federal income tax, and FICA)
4. When the calculations are performed, be sure to check for the following error:
• If any employee’s state income tax plus federal tax plus FICA is greater than the employee’s gross pay, display an error message stating that the withholdings are too great
5. Make sure to clear all textboxes and labels before entering the information for the new employee
6. Provide ‘Exit’ button which is used to terminate project execution
7. Hitting the [Esc] key should produce the same effect as clicking the ‘Exit’ button
Please design is as the image below in Form 1
Please provide comments on coding.
Employee ID: Number of Hours Worked: Houry Pay Rate: Withheld for State Income Tax Withheld for Federal Income Tax Witnheld for FICA: Employ... Gross Pay State Inc Federal... FICA Wi Net Pay EnterExplanation / Answer
Private Sub cmdProcessIt_Click() Dim monday1 As Double Dim tuesday1 As Double Dim wednesday1 As Double Dim thursday1 As Double Dim friday1 As Double Dim saturday1 As Double Dim sunday1 As Double Dim monday2 As Double Dim tuesday2 As Double Dim wednesday2 As Double Dim thursday2 As Double Dim friday2 As Double Dim saturday2 As Double Dim sunday2 As Double Dim totalHoursWeek1 As Double Dim totalHoursWeek2 As Double Dim regHours1 As Double Dim regHours2 As Double Dim ovtHours1 As Double Dim ovtHours2 As Double Dim regAmount1 As Double Dim regAmount2 As Double Dim ovtAmount1 As Double Dim ovtAmount2 As Double Dim regularHours As Double Dim overtimeHours As Double Dim regularAmount As Double Dim overtimeAmount As Double Dim totalEarnings As Double Dim hourlySalary As Double ' Retrieve the hourly salary hourlySalary = CDbl(Me.txtHourlySalary.Text) ' Retrieve the time for each day ' First Week monday1 = CDbl(Me.txtMonday1.Text) tuesday1 = CDbl(Me.txtTuesday1.Text) wednesday1 = CDbl(Me.txtWednesday1.Text) thursday1 = CDbl(Me.txtThursday1.Text) friday1 = CDbl(Me.txtFriday1.Text) saturday1 = CDbl(Me.txtSaturday1.Text) sunday1 = CDbl(Me.txtSunday1.Text) ' Second Week monday2 = CDbl(Me.txtMonday2.Text) tuesday2 = CDbl(Me.txtTuesday2.Text) wednesday2 = CDbl(Me.txtWednesday2.Text) thursday2 = CDbl(Me.txtThursday2.Text) friday2 = CDbl(Me.txtFriday2.Text) saturday2 = CDbl(Me.txtSaturday2.Text) sunday2 = CDbl(Me.txtSunday2.Text) ' Calculate the total number of hours for each week totalHoursWeek1 = monday1 + tuesday1 + wednesday1 + thursday1 + _ friday1 + saturday1 + sunday1 totalHoursWeek2 = monday2 + tuesday2 + wednesday2 + thursday2 + _ friday2 + saturday2 + sunday2 ' The overtime is paid time and half Dim ovtSalary As Double ovtSalary = hourlySalary * 1.5 ' If the employee worked under 40 hours, there is no overtime If totalHoursWeek1 < 40 Then regHours1 = totalHoursWeek1 regAmount1 = hourlySalary * regHours1 ovtHours1 = 0 ovtAmount1 = 0 ' If the employee worked over 40 hours, calculate the overtime ElseIf totalHoursWeek1 >= 40 Then regHours1 = 40 regAmount1 = hourlySalary * 40 ovtHours1 = totalHoursWeek1 - 40 ovtAmount1 = ovtHours1 * ovtSalary End If If totalHoursWeek2 < 40 Then regHours2 = totalHoursWeek2 regAmount2 = hourlySalary * regHours2 ovtHours2 = 0 ovtAmount2 = 0 ElseIf totalHoursWeek2 >= 40 Then regHours2 = 40 regAmount2 = hourlySalary * 40 ovtHours2 = totalHoursWeek2 - 40 ovtAmount2 = ovtHours2 * ovtSalary End If regularHours = regHours1 + regHours2 overtimeHours = ovtHours1 + ovtHours2 regularAmount = regAmount1 + regAmount2 overtimeAmount = ovtAmount1 + ovtAmount2 totalEarnings = regularAmount + overtimeAmount Me.txtRegularHours.Text = CStr(regularHours) Me.txtOvertimeHours.Text = CStr(overtimeHours) Me.txtRegularAmount.Text = CCur(regularAmount) Me.txtOvertimeAmount.Text = CCur(overtimeAmount) Me.txtNetPay.Text = CCur(totalEarnings) End SubRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.