Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

19. display the output Private Sub btnDisplay_Click(...) Handles btnDisplay.Clic

ID: 3700299 • Letter: 1

Question

19. display the output

Private Sub btnDisplay_Click(...) Handles btnDisplay.Click

Dim grade = CDbl(InputBox(“What is your numeric grade?”, “Grade”))

ShowResult(grade)

  End Sub

  Sub ShowResult(grade As Double)

     If (grade < 0 ) Or (grade > 100) Then

        MessageBox.Show(“Improper grade”)

        Exit Sub

     End If

     If PassedExam(grade) Then

        txtOutput.Text = “You passed with a grade of “ & grade & “.”

     Else

        txtOutput.Text = “You failed the exam.”

     End If

       End Sub

(Assume the response is 92.)

I get the answer key says you passed with a grade of 80, just need an explanation for that please.

Explanation / Answer

Let me know if you have any doubt.

Explanation:

first btnDisplay_Click function will run which will ask grade from the user:

like: What is your numeric grade?
and In question it is given , we are providing response 92.
So, grade =92 will then pass to ShowResult() function.


In ShowResult() function, there are multiple if-else statements which are checking
the conditions to match.

In ShowResult() function, we are calling another function i.e. PassedExam(grade)
which will return true and might updatating the grade marks to 80. Hence,
the result is 'you passed with a grade of 80'.

note: PassedExam() function is not there in your code. So, can't exactly tell
you how grade is become 80.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote