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

Write a program that requests the numeric grades on a midterm and a final exam a

ID: 3531982 • Letter: W

Question

Write a program that requests the numeric grades on a midterm and a final exam and then uses a Function procedure to assign a semester grade (A, B, C, D, OR F). The final exam should count twice as much as the midterm exam, the semester average should be rounded up to the nearest whole number, and the semester grade should be assigned by the folowing criteria: 90-100 (A), 80-89 (B), ... Use a function called Ceil that rounds noninteger numbers up to the nearest integer. The function Ceil can be defined by Ceil(x) = -int(-x).Type your question here

All events must be handled though a button. The midterm grade and final exam grade will be entered into textbox's, when the button is clicked, the output will be displayed in either a textbox or a listbox.

Explanation / Answer

Public Class frm18

Private Sub btnGrades_Click(sender As System.Object, e As System.EventArgs) Handles btnGrades.Click
Dim midtermG As Double
Dim finalG As Double
midtermG = (InputBox("Please enter your midterm exam grade!"))
finalG = (InputBox("Please enter your final exam grade!"))
SemesterGrade(midtermG, finalG)
End Sub

Sub SemesterGrade(ByVal midtermG As Double, ByVal finalG As Double)
Dim result As Double
Dim average As Double
average = (finalG + midtermG) / 2
result = Math.Ceiling(average)
txtOutput.Text = "Your semester grade is " & Grade(result) & "."
End Sub

Function Ceil(ByVal x As Double) As Double
Return -Int(-x)
End Function

Function Grade(ByVal result As Double) As String
If result <= 90 And result >= 100 Then
Grade = "A"
ElseIf result <= 80 And result > 90 Then
Grade = "B"
ElseIf result <= 70 And result >= 60 Then
Grade = "C"
ElseIf result <=50 And result >= 40Then
Grade = "D"
Else
Grade = "F"
End If
End Function


End Class

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