Question
Open the Gross Pay Solution.sln file contained in the VB2017Chap08Gross Pay Solution folder. The interface provides a text box for entering the number of hours
Open the Gross Pay Solution.sln file contained in the VB2017\Chap08\Gross Pay Solution folder. The interface provides a text box for entering the number of hours an employee worked. It also provides a list box for selecting the employees pay code. The btnCalc_Click procedure should display the gross pay, using the number of hours worked and the pay rate corresponding to the selected code. The pay codes and rates are listed in Figure 8-47. Employees working more than 40 hours receive time and a half for the hours worked over 40. Code the application. Use a class-level array to store the pay rates. Save the solution and then start and test the application.
Option Explicit On Option Strict On Option Infer Off
Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles Me.Load ' Selects the first pay code in the list box.
lstCodes.SelectedIndex = 0 End Sub
Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click Me.Close() End Sub
Private Sub ClearGross(sender As Object, e As EventArgs) Handles lstCodes.SelectedIndexChanged, txtHours.TextChanged lblGross.Text = String.Empty End Sub
Private Sub txtHours_Enter(sender As Object, e As EventArgs) Handles txtHours.Enter txtHours.SelectAll() End Sub
Private Sub txtHours_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtHours.KeyPress ' Accept only numbers, the period, and the Backspace key.
If (e.KeyChar "9") AndAlso e.KeyChar "." AndAlso e.KeyChar ControlChars.Back Then e.Handled = True End If End Sub
Private Sub btnCalc_Click(sender As Object, e As EventArgs) Handles btnCalc.Click
End Sub End Class
Pay code P23 P56 F45 F68 F96 Pay rate 10.50 12.50 14.25 15.75 17.65 Figure 8-47 Pay codes and rates for Exercise 3
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