4 Replies - 579 Views - Last Post: 09 March 2012 - 09:29 AM Rate Topic: -----

#1 tivoli  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 09-March 12

GPA Average Problem.. Loops and Counters? HELP!

Posted 09 March 2012 - 12:29 AM

Hi. I am having trouble programming a solution that will allow the user to select their gender from a listbox along with their GPA and then having such labels as "All Students" "Male Students" and "Female Students" display the average for all of the user inputs. This assignment deals with loops, counters, and accumulators. I am currently stuck and I need someone to please help! I would appreciate it so much!

This is what I have so far

Public Class Form1

    Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles genderListBox.SelectedIndexChanged

    End Sub

    Private Sub gpaListBox_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles gpaListBox.SelectedIndexChanged


    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Me.Close()
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        'add items to genderListBox
        Dim gender As String
        gender = CStr(genderListBox.Text)

        genderListBox.Items.Add("M")
        genderListBox.Items.Add("F")

        

        

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        allLabel.Text = Convert.ToString(gpaListBox.SelectedItem)
        If genderListBox.SelectedItem = "M" Then
            maleLabel = maleLabel + allLabel
        End If
        If genderListBox.SelectedItem = "F" Then femaleLabel.Text = Convert.ToString(gpaListBox.SelectedItem)

        Dim projectCounter As Integer = +1
        Dim totalAccumulator As Integer



        Do While projectCounter > 50
            projectCounter += 1

        Loop




        Dim all As Decimal
        all = CDec(allLabel.Visible = True)

        Dim male As Decimal
        male = CDec(maleLabel.Visible = True)

        Dim female As Decimal
        female = CDec(femaleLabel.Visible = True)





    End Sub

    Private Sub all_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles allLabel.Click

    End Sub
End Class


Is This A Good Question/Topic? 0
  • +

Replies To: GPA Average Problem.. Loops and Counters? HELP!

#2 nK0de  Icon User is offline

  • Catch me As Exception
  • member icon

Reputation: 204
  • View blog
  • Posts: 823
  • Joined: 21-December 11

Re: GPA Average Problem.. Loops and Counters? HELP!

Posted 09 March 2012 - 12:38 AM

what exactly is your problem?? where are you stuck?

btw You're missing the End If at line 37. And you don't really have to specify +1 when declaring numbers(line 39). They are positive by default.

And explain what you're trying to do here. line 52 - 59

This post has been edited by nK0de: 09 March 2012 - 12:43 AM

Was This Post Helpful? 0
  • +
  • -

#3 tivoli  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 09-March 12

Re: GPA Average Problem.. Loops and Counters? HELP!

Posted 09 March 2012 - 01:04 AM

The program is supposed to allow the users to choose their GPA from a list of values in a list box and also to allow them to choose whether they are Male or Female from a list box. From these two selections each user makes, there are three labels (Male Average, Female Average, and All Students Average) that will display the average GPA for each type of student.

Please help!
Was This Post Helpful? 0
  • +
  • -

#4 nK0de  Icon User is offline

  • Catch me As Exception
  • member icon

Reputation: 204
  • View blog
  • Posts: 823
  • Joined: 21-December 11

Re: GPA Average Problem.. Loops and Counters? HELP!

Posted 09 March 2012 - 01:37 AM

That's not the answer to what I asked. That's the question given to you.
Tell me what's the exact problem your having with your code? what are the errors if getting any.

This post has been edited by nK0de: 09 March 2012 - 01:38 AM

Was This Post Helpful? 0
  • +
  • -

#5 tivoli  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 09-March 12

Re: GPA Average Problem.. Loops and Counters? HELP!

Posted 09 March 2012 - 09:29 AM

I have everything coded correctly except finding a way to code the labels that show the averages of all the inputs of "male", "female", and "all students".
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1