Question

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

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

Gross Pay Calculator Hours: Code: P23 Calculate P56 Exit Gross pay: F45 F68 F96

0 0
Add a comment Improve this question Transcribed image text
Answer #1

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

Quick Launch (Ctrl+Q) - x Gross Pay Calculator - Microsoft Visual Studio FILE EDIT VIEW PROJECT BUILD DEBUG TEAM SQL 2. Start

output

Quick Launch (Ctrl+Q) - x Properties www IX Gross Pay Calculator (Running) - Microsoft Visual Studio FILE EDIT VIEW PROJECT B

Quick Launch (Ctrl+Q) - x Properties www IX Gross Pay Calculator (Running) - Microsoft Visual Studio FILE EDIT VIEW PROJECT B

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.

Add a comment
Know the answer?
Add Answer to:
Open the Gross Pay Solution.sln file contained in the VB2017\Chap08\Gross Pay Solution folder. The interface provides...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Open the Calories Solution.sln file contained in the VB2017\Chap08\Calories Solution folder. Open the Code Editor window...

    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...

    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...

    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...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT