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

Create a GPA calculator. Ask the user to input a list of classesand the number o

ID: 3558427 • Letter: C

Question

Create a GPA calculator. Ask the user to input a list of classesand the number of tests per class. Once the user has entered thisinitial information, allow the list to be saved when the user exitsthe program. When the program starts, any existing data should beloaded automatically. After the user has entered the list ofclasses and number of tests for each class, the user can then entergrades for each test. Create a button that allows the user torequest a GPA calculation at any time. (GPA = average for eachclass averaged for the total number of classes in a semester.)

Explanation / Answer

Public Class GPA_Form Private Sub exitButton_Click(sender As System.Object, e As System.EventArgs) Handles exitButton.Click Me.Close() End Sub Private Sub entdatButton_Click(sender As System.Object, e As System.EventArgs) Handles entdatButton.Click Const Prompt As String = "Enter number of Credit Hours:" Const Title As String = "Credit Hours" Const Prompt2 As String = "Enter grades:" Const Title2 As String = "Grades" Dim inputCredit As String Dim inputGrades As String Dim creditHrs As Integer Dim grades As Char Dim gradesCounter As Integer Dim creditHrsAccumulator As Integer Dim point As Integer Dim gpaTot As Integer Dim pntAccumulator As Integer inputCredit = InputBox(Prompt, Title) inputGrades = InputBox(Prompt2, Title2) Do While inputCredit String.Empty Integer.TryParse(inputCredit, creditHrs) Char.TryParse(inputGrades, grades) gradesCounter += 1 creditHrsAccumulator += creditHrs Select Case grades Case Is >= "A" point = 4 Case Is >= "B" point = 3 Case Is >= "C" point = 2 Case Is >= "D" point = 1 Case Is >= "F" point = 0 End Select pntAccumulator += point gpaTot = pntAccumulator / gradesCounter tchData.Text = creditHrsAccumulator.ToString("N0") numGrEnt.Text = gradesCounter.ToString("N0") gpaData.Text = gpaTot.ToString("N2") inputCredit = InputBox(Prompt, Title) inputGrades = InputBox(Prompt2, Title2) Loop End Sub End Class