The following sample of code contains errors. Rewrite the incorrect statements to correct all errors.
-Structure ExamGrades
Public decExam1 As Decimal
Public decExam2 As Decimal
Public decExam3 As Decimal
End Structure
---------------------------
Private Function CalcAverage(ByVal grades As Decimal)As Decimal
' calculates and returns the average grade
Dim decSum As Decimal
decSum = grades.Exam1 + grades.Exam2 +
grades.Exam3
Return decSum * 3
End Function
---------------------------
Private Sub btnAverage_Click(ByVal sender As Object,ByVal e As System.EventArgs)Handles btnAverage.Click
' display the average exam grade
Dim threeGrades As ExamGrades
Dim decAverage As Decimal
Decimal.TryParse(txtGrade1.Text,decExam1)
Decimal.TryParse(txtGrade2.Text,decExam2)
Decimal.TryParse(txtGrade3.Text,decExam3)
decAverage = CalcAverage(threeGrades)
lblResult.Text = decAverage.ToString("N1")
End Sub
Correct Answer:
Verified
Public decExam1 As ...
View Answer
Unlock this answer now
Get Access to more Verified Answers free of charge
Q44: The following sample of code contains errors.
Q45: Describe two advantages to programmers of using
Q46: Write a Structure statement that defines a
Q47: What is the difference between an input
Q48: Write the code to declare a variable
Q50: What is the difference between a structure
Q51: Case 1 - Frames Unlimited
Frames Unlimited is
Q52: Write the code to declare a variable
Q53: Case 1 - Frames Unlimited
Frames Unlimited is
Q54: Case 1 - Frames Unlimited
Frames Unlimited is
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