I need to create a program to determine a student's GPA. The user should enter the grade (A, B, C, D, or F) and the number of credit hours for a course, and then click on the Record This Course button. The user should then repeat this process for all their courses. After all the course have been recorded, the user should click on the Calculate GPA button. A function procedure should be used to calculate the quality points for a course.
This is my code. Yes, I realize that it doesn't work at all and that there are for sure many mistakes. I also don't have a function procedure like I need.
Specifically, I have not been able to get a handle of how to add up the grade values, and course hours cumulatively.
I'm completely lost. Any help would be very much appreciated =)
Public Class Form1
Dim Credits As Double
Dim CumulativeGPA As Double
Private Sub btnRecord_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRecord.Click
CumulativeGPA += CourseGrade()
CourseGrade =
Credits += CDbl(txtCredits.Text)
If txtGrade.Text = "A" Then
CumulativeGPA += 4
End If
If txtGrade.Text = "B" Then
CumulativeGPA += 3
End If
If txtGrade.Text = "C" Then
CumulativeGPA += 2
End If
If txtGrade.Text = "D" Then
CumulativeGPA += 1
End If
If txtGrade.Text = "F" Then
CumulativeGPA += 0
End If
txtCredits.Clear()
txtGrade.Clear()
txtGrade.Focus()
End Sub
Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click
Dim totalGPA As Double = CumulativeGPA / Credits
txtTotalGPA.Text = CStr((totalGPA))
End Sub
End Class