VS 2010 GPA Calculator Code Help-VBForums
Results 1 to 2 of 2

Thread: GPA Calculator Code Help

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2011
    Posts
    1

    GPA Calculator Code Help

    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

  2. #2
    Frenzied Member make me rain's Avatar
    Join Date
    Sep 2008
    Location
    india/Hubli
    Posts
    1,916

    Re: GPA Calculator Code Help

    Welcome Ham
    i am unable to visualize your project.
    be specific like this
    (1)
    Code:
    The user should enter the grade (A, B, C, D, or F)
    where ?
    (2)
    Code:
    number of credit hours for a course
    ? where ?
    (3)
    Code:
    user should then repeat this process for all their courses.
    Courses ?
    (4)
    Code:
    the user should click on the Calculate GPA
    GPA formula ?

    by the above i can assume that
    you are having 2 text boxes + 1 or 2 command buttons
    on button click you need to display the GPA output basing on values in 2 text boxes ?
    The averted nuclear war
    My notes:

    PrOtect your PC. MSDN Functions .OOP LINUX forum
    .LINQ LINQ videous
    If some one helps you please rate them with out fail , forum doesn't expects any thing other than this

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.