Problems: Correcting Logic and Code ErrorsThe 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.50Dim strEmpCode As StringDim decPayRate As IntegerstrCode = txtEmpCode.Text.Snip' validate the employee codeIf strEmpCode = "FT##" ThendecPayRate = 11.50ElseIf strEmpCode Like "PT30##" ThendecPayRate = 9.50ElsedecPayRate = 10.50End If' display pay ratelblPayRate.Text = decPayRate.ToString("N2")End Sub
What will be an ideal response?
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 Decimal
strEmpCode = txtEmpCode.Text.Trim
' validate the employee code
If strEmpCode Like"FT##" Then
decPayRate = 11.50
ElseIf strEmpCode Like "PT30##" Then
decPayRate = 10.50
Else
decPayRate = 9.50
End If
' display pay rate
lblPayRate.Text = decPayRate.ToString("N2")
End Sub
You might also like to view...
Variable declarations in event handlers begin with their .
a) name b) value c) type d) None of the above.
Identify the letter of the choice that best matches the phrase or definition.
A. A block-level element that adds white space above and below B. Includes communications technologies such as email, file transfers, and other data transfers from one network to another C. Navigated with software called a browser D. A technology that allows you to click a link that points to a file E. When two or more computers are connected together F. Software that provides error messages and warnings if the code in a document does not conform to the rules of the specified version of HTML G. Information about a document, such as its keywords H. A Web page address I. For HTML files; html or htm J. Used to mark the importance of content and to bring attention to important topics on the page K. Contained within a block-level element and not surrounded by additional white space L. By default, renders text in italic
The size of a computer motherboard is known as its
A) Visual Interface Size (VIS) B) Hardsize C) Area platform D) Form factor
You can use a(n) picture to present complex material that makes useful comparisons._________________________
Answer the following statement true (T) or false (F)