Processing - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Processing

I am working on my first program to be released and i have one hitch
here is the code
[code]
Private Sub addcourses_Click()
A = 4
B1 = 3.5
B = 3
C1 = 2.5
C = 2
D = 1
F = 0
totalgradepoints = 0

If numofcourses.Text = "" Then
Do
errormsg = MsgBox("Enter a Value For No.Of Courses Taken", vbOKOnly + vbCritical, "Course Value Error")

Loop Until errormsg = 1

Else
courses = numofcourses.Text
For limit = 1 To courses
course = InputBox("Enter Course ", "", "Course", 1800, 3700)
grade = InputBox("Enter Course Grade", "", "Grade", 1800, 3700)
courselist.AddItem course
gradelist.AddItem grade

Next
cmdcalculate.Enabled = True





End If 'Ends the if statement for the error msg

End Sub

_______________________________________________________________________
Private Sub cmdcalculate_Click()
A = 4
B1 = 3.5 'B+ grades
B = 3
C1 = 2.5
C = 2
D = 1
F = 0
totalgradepoints = 0
courses = numofcourses.Text
totalcredits = courses * 3

For limit = 1 To gradelist.ListCount



counter = counter + 1

'End If
End If
End If
End If
Next


gpaoutput = Str$(gradepoint)

End Sub
[/code]

the porblem is how do i process the grades in the gradelistbox so that i can calculate the gpa?
this program is a designed student helper

Comments

  • ZantosZantos Posts: 139Member
    First off, depending on how many classes they are taking, you'll want to set up an array of textboxes. We're going to use the name txtGradeForClass as the example.

    [code]
    '//Find out how many classes are being taken
    Dim nClasses As Integer
    nClasses = CInt(txtNumberOfClasses) '//Converts variable to integer

    '//Retreive the grades for each class and total up GPA
    Dim nGPA As Single '//Singles hold small decimals
    Dim nTemp As Integer
    For i = 1 To nClasses
    '//Change letter value to decimal value
    Select Case txtNumberOfClasses(i)
    Case "A"
    nTemp = 4
    Case "B"
    nTemp = 3
    Case "C"
    nTemp = 2
    Case "D"
    nTemp = 1
    Case "F"
    nTemp = 0
    End Select
    '//Add class grades
    nGPA = nGPA + nTemp
    Next i

    '//Get and Display GPA
    nGPA = nGPA / nClasses
    lblGPA = "Your GPA is: " & nGPA
    [/code]
    That should work...yeah, yeah it should. Alright, well if you need further assistance, it isn't too hard to track me down :P

    : I am working on my first program to be released and i have one hitch
    : here is the code
    : [code]
    : Private Sub addcourses_Click()
    : A = 4
    : B1 = 3.5
    : B = 3
    : C1 = 2.5
    : C = 2
    : D = 1
    : F = 0
    : totalgradepoints = 0
    :
    : If numofcourses.Text = "" Then
    : Do
    : errormsg = MsgBox("Enter a Value For No.Of Courses Taken", vbOKOnly + vbCritical, "Course Value Error")
    :
    : Loop Until errormsg = 1
    :
    : Else
    : courses = numofcourses.Text
    : For limit = 1 To courses
    : course = InputBox("Enter Course ", "", "Course", 1800, 3700)
    : grade = InputBox("Enter Course Grade", "", "Grade", 1800, 3700)
    : courselist.AddItem course
    : gradelist.AddItem grade
    :
    : Next
    : cmdcalculate.Enabled = True
    :
    :
    :
    :
    :
    : End If 'Ends the if statement for the error msg
    :
    : End Sub
    :
    : _______________________________________________________________________
    : Private Sub cmdcalculate_Click()
    : A = 4
    : B1 = 3.5 'B+ grades
    : B = 3
    : C1 = 2.5
    : C = 2
    : D = 1
    : F = 0
    : totalgradepoints = 0
    : courses = numofcourses.Text
    : totalcredits = courses * 3
    :
    : For limit = 1 To gradelist.ListCount
    :
    :
    :
    : counter = counter + 1
    :
    : 'End If
    : End If
    : End If
    : End If
    : Next
    :
    :
    : gpaoutput = Str$(gradepoint)
    :
    : End Sub
    : [/code]
    :
    : the porblem is how do i process the grades in the gradelistbox so that i can calculate the gpa?
    : this program is a designed student helper
    :
    :

    [code]
    [b]..:[/b] Zantos [b]:..[/b]
    [blue]Mega[/blue][red]Riot[/red] Productions
    http://www.megariot.funurl.com
    [/code]

Sign In or Register to comment.