0% found this document useful (0 votes)
92 views

GPA Calculator Using Visual

This document describes a GPA calculator program created using Visual Basic.Net. The program calculates the GPA for 5 courses by allowing the user to enter a letter grade and credits for each course. It then uses these inputs to calculate the total credits, grade points for each course based on the letter grade, total grade points, and final GPA. The program also includes a reset button to clear the user inputs.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
92 views

GPA Calculator Using Visual

This document describes a GPA calculator program created using Visual Basic.Net. The program calculates the GPA for 5 courses by allowing the user to enter a letter grade and credits for each course. It then uses these inputs to calculate the total credits, grade points for each course based on the letter grade, total grade points, and final GPA. The program also includes a reset button to clear the user inputs.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

2/25/22, 8:17 AM GPA Calculator using Visual Basic.

Net

l   Register  Login

HOME C++ J AVA PY THON C# MORE

 ALL CATEGORIES 3
Search for Code... SEARCH

GPA Calculator using Visual Basic.Net


Posted by Samath
Last Updated: February 07, 2017
10585

This is a GPA calculator that was programmed using visual basic. It calculates the grades for 5 courses. Feel free to modify

the program, add more courses or more features. If you have any question leave it in the comment section below. 

https://sourcecodeera.com/blogs/Samath/GPA-Calculator-using-Visual-BasicNet.aspx 1/4
2/25/22, 8:17 AM GPA Calculator using Visual Basic.Net

Public Class frmMain


 
Dim lettergrd As String
Dim credit As Double
Dim caltimes As Double = 0
Dim totalcal As Double = 0
Dim totalcredit As Double = 0
Dim finalgpa As Double = 0
Dim A As Double = 4.0
Dim AMINUS As Double = 3.67
Dim BPLUS As Double = 3.33
Dim B As Double = 3.0
Dim BMINUS As Double = 2.67
Dim CPLUS As Double = 2.33
Dim C As Double = 2.0
Dim CMINUS As Double = 1.67
Dim D As Double = 1.0
Dim F As Double = 0.0
Private Sub btncalculateGPA_Click(sender As Object, e As EventArgs) Handles btncalculateGPA.Click
lettergrd = ""
credit = 0
caltimes = 0
totalcal = 0
totalcredit = 0
finalgpa = 0
Dim defaultcombo = New ComboBox()
Dim defaultnumeric = New NumericUpDown()
For i As Integer = 1 To 5
 
Select Case i
Case 1
defaultcombo = cmbCourse1
defaultnumeric = numCourse1
Exit Select
Case 2
defaultcombo = cmbCourse2
defaultnumeric = numCourse2
Exit Select
Case 3
defaultcombo = cmbCourse3
defaultnumeric = numCourse3
Exit Select
Case 4
defaultcombo = cmbCourse4
defaultnumeric = numCourse4
Exit Select
Case 5
defaultcombo = cmbCourse5
defaultnumeric = numCourse5
Exit Select
End Select
 
lettergrd = defaultcombo.Text
credit = [Double].Parse(defaultnumeric.Value.ToString())
 
 
If lettergrd <> [String].Empty AndAlso credit <> 0 Then
 
Select Case lettergrd
Case "A"
caltimes = credit * A
Exit Select
Case "A-"
caltimes = credit * AMINUS
Exit Select
Case "B+"
caltimes = credit * BPLUS
Exit Select
Case "B"
caltimes = credit * B
Exit Select

https://sourcecodeera.com/blogs/Samath/GPA-Calculator-using-Visual-BasicNet.aspx 2/4
2/25/22, 8:17 AM GPA Calculator using Visual Basic.Net

Case "B-"
caltimes = credit * BMINUS
Exit Select
Case "C+"
caltimes = credit * CPLUS
Exit Select
Case "C"
caltimes = credit * C
Exit Select
Case "C-"
caltimes = credit * CMINUS
Exit Select
Case "D"
caltimes = credit * D
Exit Select
Case "F"
caltimes = credit * F
Exit Select
 
End Select
 
totalcredit = totalcredit + credit
totalcal = totalcal + caltimes
 
End If
Next
 
finalgpa = totalcal / totalcredit
 
lblfinalgpa.Text = finalgpa.ToString("#.00")
 
 
End Sub
 
Private Sub btnReset_Click(sender As Object, e As EventArgs) Handles btnReset.Click
cmbCourse1.ResetText()
cmbCourse2.ResetText()
cmbCourse3.ResetText()
cmbCourse4.ResetText()
cmbCourse5.ResetText()
 
numCourse1.ResetText()
numCourse2.ResetText()
numCourse3.ResetText()
numCourse4.ResetText()
numCourse5.ResetText()
 
lblfinalgpa.Text = "0.00"
End Sub
End Class

Login to Comment

https://sourcecodeera.com/blogs/Samath/GPA-Calculator-using-Visual-BasicNet.aspx 3/4
2/25/22, 8:17 AM GPA Calculator using Visual Basic.Net

About Us Asp.net

C++ .Net

Java HTML

C# JQuery

Visual Basic XML

C Python

Php CSS

Javascript SQL

View All Unity3D

https://sourcecodeera.com/blogs/Samath/GPA-Calculator-using-Visual-BasicNet.aspx 4/4

You might also like