# GPA calculator

Page 1 of 1

## 1 Replies - 257 Views - Last Post: 16 February 2019 - 07:58 PMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'https://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=414934&amp;s=dba74194c8e2befeccf21577b858581c&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 gunlake2012

• New D.I.C Head

Reputation: 0
• Posts: 5
• Joined: 15-February 19

# GPA calculator

Posted 15 February 2019 - 10:33 PM

Looking for help. My assignment is to create a program that displays gpa. I must select male or female. Then Select the gpa and hit calculate everytime. SO i need to find the average. Each time i hit calculate it must add the current gpa and find the new current average. Thats where im having issues. cant figure out how to average it.

Thanks.

```' Name:         GPA Project
' Purpose:      Calculate Average GPA for All Students/Gender Average
' Programmer:   Alex Fare on 02/15/2019

Option Explicit On
Option Strict On
Option Infer Off
Public Class Form1
Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
Me.Close()
End Sub

Private dblGpa As Double
Dim dblMale As Double
Dim dblFemale As Double
Private dblRun As Double
Dim dblMaleCount As Double
Dim dblFemaleCount As Double

Private Sub btnCalc_Click(sender As Object, e As EventArgs) Handles btnCalc.Click
Dim dblGpaSave As Double
Dim dblAllStudents As Double
Dim dblAverage As Double
Dim dblAvgMale As Double
Dim dblAvgFemale As Double

Double.TryParse(lstGpa.Text, dblGpa)
Double.TryParse(lblAllStudents.Text, dblAllStudents)
Double.TryParse(lblFemaleStudents.Text, dblfemale)
Double.TryParse(lblMaleStudents.Text, dblMale)

Select Case True
Case chkFemale.Checked
dblAvgFemale += dblGpa + dblGpaSave
dblFemaleCount += 1
dblFemale = dblAvgFemale / dblFemaleCount
End Select
Select Case True
Case chkMale.Checked
dblAvgMale += dblGpa + dblGpaSave
dblMaleCount += 1
dblMale = dblAvgMale / dblMaleCount
End Select

dblAverage += dblGpa + dblGpaSave
dblRun += 1
dblAllStudents = dblAverage / dblRun

lblAllStudents.Text = dblAllStudents.ToString("N2")
lblMaleStudents.Text = dblMale.ToString("N2")
lblFemaleStudents.Text = dblFemale.ToString("N2")

End Sub
End Class

```

Is This A Good Question/Topic? 0

## Replies To: GPA calculator

### #2 modi123_1

• Suitor #2

Reputation: 14924
• Posts: 59,580
• Joined: 12-June 08

## Re: GPA calculator

Posted 16 February 2019 - 07:58 PM

You are using SELECT statements wrong. Just use IF