Visual Basic is an application development language created by Microsoft that’s used to develop desktop software applications. Like most programming languages, VB can be used to execute mathematical equations, such as average calculations used to calculate grade point averages. By following the steps in this article, you can create a GPA calculator that allows the user to enter a grade and save it to the application’s database, where it will be averaged. Public Class Form Dim Credits As Double Dim GPA As Double Private Sub btnRecord_Click(byVal sender as System.Object, System.EventArgs) Handles btnRecord.Click GPA += Grade() Grade = Credits += CDbl(Credits.text) If Grade.Text = “A” Then GPA += 4 End If If Grade.Text = “B” Then GPA += 3 End If If Grade.Text = “C” Then GPA += 2 End If If Grade.Text = “D” Then GPA += 1 End If End Sub Private Sub btnCalculate_Click(ByVal sender as System.Object, As System.EventArgs) Handles btnCalculate.Click Dim averageGPA As Double = GPA / Credits textGPA.Text = CStr((GPA)) End Sub End Class Writer Bio
