Thursday, December 15, 2011

Grade Generator

1. Construct the user interface as follows:



2. Code:


Public Class frmGradeGenerator

Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click

Dim FinalGrade As Single

FinalGrade = Val(txtPrelimGrade.Text) * 0.3 + Val(txtMidtermGrade.Text) * 0.3 + Val(txtFinalsGrade.Text) * 0.4

txtFinalGrade.Text = FinalGrade

Select Case FinalGrade

Case 98 To 100
txtEquivalentGrade.Text = "1.0"
txtRemarks.Text = "Excellent"

Case 95 To 97
txtEquivalentGrade.Text = "1.25"
txtRemarks.Text = "Outstanding"

Case 92 To 94
txtEquivalentGrade.Text = "1.5"
txtRemarks.Text = "Very Good Work"

Case 89 To 91
txtEquivalentGrade.Text = "1.75"
txtRemarks.Text = "Very Satisfactory work"

Case 86 To 88
txtEquivalentGrade.Text = "2.0"
txtRemarks.Text = "Quite Good Work"

Case 83 To 85
txtEquivalentGrade.Text = "2.25"
txtRemarks.Text = "Good Work"

Case 80 To 82
txtEquivalentGrade.Text = "2.5"
txtRemarks.Text = "Satisfactory Work"

Case 77 To 79
txtEquivalentGrade.Text = "2.75"
txtRemarks.Text = "Moderately Satisfactory Work"

Case 75 To 76
txtEquivalentGrade.Text = "3.0"
txtRemarks.Text = "Passing"

Case Is < 75
txtEquivalentGrade.Text = "5.0"
txtRemarks.Text = "Failure"

Case Else
MsgBox("You Enter an Invalid Grade", MsgBoxStyle.Exclamation, "Warning")

End Select
End Sub

End Class

3. Save and Run the program.

No comments:

Post a Comment