Problems - Correcting Logic and Code Errors
The following sample of code contains errors. Rewrite the incorrect statements to correct all errors.
Private Sub btnDisplay_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnDisplay.Click
' displays a pay rate based on an employee's code
' Full Time employee pay rate is 11.50. Part Time
' employee pay rate for those working more than 30 hours
' is 10.50, otherwise it is 9.50
Dim strEmpCode As String
Dim decPayRate As Integer
strCode = txtEmpCode.Text.Snip
' validate the employee code
If strEmpCode = "FT##" Then
decPayRate = 11.50
ElseIf strEmpCode Like "PT30##" Then
decPayRate = 9.50
Else
decPayRate = 10.50
End If
' display pay rate
lblPayRate.Text = decPayRate.ToString("N2")
End Sub
Correct Answer:
Verified
View Answer
Unlock this answer now
Get Access to more Verified Answers free of charge
Q41: The strSerialNum variable contains the string "DRY259614".Write
Q43: Write a Visual Basic statement that will
Q46: Write the condition that evaluates to True
Q49: Case-Based Critical Thinking Questions Case 1 -
Q49: The strCityState variable contains the string "AtlantaGA".Write
Q51: The strPhone variable contains a 10-digit phone
Q51: Case-Based Critical Thinking Questions Case 1 -
Q52: Write a Visual Basic statement that removes
Q53: Write the Visual Basic statements needed to
Q54: The strCityState variable contains a string that
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents