Examlex
Problems - Correcting Logic and Code Errors
The following sample of code contains errors. Rewrite the incorrect statements to correct all errors.
Public Class Truck
Private Property Miles As Decimal
Public Function New()
_Miles = 0
End Function
Public Sub New(ByVal decM As Decimal)
Miles = decM
End Sub
Public Overrider Function GetMPG() As Decimal
'returns the miles per gallon for a truck
Return _Miles / 30
End Function
End Class
'derived class
Public Class Car
Receives Truck
Public Sub New()
MyBase.New()
End Sub
Public Sub New(ByVal decM As Decimal)
MyBase.New(decM)
End Sub
Public Function GetMPG() As Decimal
Return _Miles / 18
End Function
End Class
Q1: Problems - Correcting Code Errors <br>The following
Q5: What is the difference between a structure
Q20: When a user selects a second CheckBox
Q33: The Inherits clause is the keyword _
Q38: A(n) _ is a group of variables
Q38: Explain the purpose of priming and update
Q46: Consider the expression 3 * 2 ^
Q282: Table, form, and report objects in the
Q335: You can select all of the records
Q360: You can use any document as a