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 employee’s 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 applicatio
Code
Public Class Form1
Dim rate() As Decimal ''class level array
Private Sub btnCalculate_Click(sender As Object, e As EventArgs)
Handles btnCalculate.Click
Dim hourlyRate = rate(lstCode.SelectedIndex)
Dim grossPay As Decimal
Dim hourWorked As Integer
hourWorked = Convert.ToInt32(txtHours.Text)
If hourWorked > 40 Then
grossPay = 40 * hourlyRate
grossPay += (hourWorked - 40) * 1.5 * hourWorked
Else
grossPay = hourWorked * hourlyRate
End If
txtGrossPay.Text = grossPay.ToString("C")
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles
MyBase.Load
rate = {10.5, 12.5, 14.25, 15.75, 17.68}
End Sub
Private Sub btnExit_Click(sender As Object, e As EventArgs)
Handles btnExit.Click
Me.Close()
End Sub
End Class
Design
output
If you have any query regarding the code please ask me in the
comment i am here for help you. Please do not direct thumbs down
just ask if you have any query. And if you like my work then please
appreciates with up vote. Thank You.
Open the Gross Pay Solution.sln file contained in the VB2017\Chap08\Gross Pay Solution folder. The interface provides...
Open the Calories Solution.sln file contained in the VB2017\Chap08\Calories Solution folder. Open the Code Editor window and locate the btnDisplay_Click procedure. The procedure declares and initializes a one-dimensional array named intCalories. The array stores the numbers of daily calories consumed. The procedure should calculate and display the average number of calories consumed; use the Math.Round method to round the average to an integer. (You learned about the Math.Round method in Chapter 6.) The procedure should also display the number of...
Open the Validate Number Solution.sln file contained in the VB2017\Chap07\Validate Number Solution folder. The interface provides a text box for entering a 9-digit number. The btnValidate_Click procedure should use the algorithm and example shown in Figure 7-56 to validate the user’s entry. The procedure should display a message indicating whether the entry is or is not valid. Code the procedure. Include any other code that will professionalize the interface. Save the solution and then start and test the application. Create...
Open the Chang Solution (Chang Solution.sln) file contained in the VbReloaded2015\ Chap11\Chang Solution folder. The application should display a grade based on the number of points entered by the user. The grading scale is shown in Figure 11-47. Create a structure that contains two members: an Integer variable for the minimum points and a String variable for the grades. Use the structure to declare a class-level one-dimensional array that has five elements. The MainForm_Load procedure should store the minimum points...