Problems: Correcting Logic and Code ErrorsThe following sample of code contains errors. Rewrite the incorrect statements to correct all errors.
' calculate and return the miles per gallon
Private Function GetMPG(ByVal dblMiles,
ByVal dblGallons) As Double
Return dblMPG = dblMiles / dblGallons
End Sub
?
' call the function to calculate miles per gallon
' pass variables for the calculation
intMPG = GetMPG()
What will be an ideal response?
' calculate and return the miles per gallonPrivate Function GetMPG(ByVal dblMiles As Double, ByVal dblGallons As Double) As DoubleReturn dblMiles / dblGallonsEnd Function' call the function to calculate miles per gallon' pass variables for the calculationdblMPG = GetMPG(dblNumMiles, dblNumGallons)
Computer Science & Information Technology
You might also like to view...
By default, an audio plays across multiple slides
Indicate whether the statement is true or false
Computer Science & Information Technology
You use a port scanner to scan a system and find port 80 open. What type of service is most likely running on that system?
a. FTP server b. Web server c. DNS server d. Telnet server
Computer Science & Information Technology