CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2009
    Posts
    2

    Talking VB grade calculator help, please..

    Thank you, problem solved.
    Last edited by markpete; April 20th, 2009 at 05:00 PM. Reason: Added Code Tags

  2. #2
    Join Date
    Jun 2004
    Location
    Kashmir, India
    Posts
    6,808

    Re: VB grade calculator help, please..

    [ Moved to VB.NET ]

  3. #3
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,284

    Re: VB grade calculator help, please..

    Welcome to the forums!

    Not sure I understand. You mentioned that you don't know the number of students, and that it will be inputted by the user dureing run time. But, if I look at your code, you have an Inputbox asking how many will be graded, and that result gets stored inside intNumberStudents

    Isn't that then, what you're looking for ¿

  4. #4
    Join Date
    Apr 2009
    Posts
    2

    Re: VB grade calculator help, please..

    Thank you for your reply.

    I am mostly looking to calculate the CLASS average (the average of all of the student's averages...) as well as the highest student average in the class and the lowest student average in the class..

    In other words, each loop I calculate sngStudentAvg (the average for that individual student)... but when the loop ends and goes to student #2, that sngStudentAvg is recalculated based on the iput of 6 grades for the next student... I use the same sngStudentAvg variable to calculate each student's individual average.... but then I need to find a class average... I can't make an sngStudentAvg1, sngStudentAvg2, and so on, because I don't know how many students are in the class until the user inputs that...

    So, with each loop, the sngStudentAvg changes, however, it has nowhere to be stored or retrieved to find the average of the sngStudentAvgs... do you see now?

  5. #5
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: VB grade calculator help, please..

    Sounds like you just need to create a couple more variables. One to hold the total grade and another to hold the total number of grades. Or one to hold the total avergages and another to hold the total number of averages then you can get your overall average from these 2 varaibles.

    for example after you assign sngStudentAvg in your loop you could add another line something like

    Code:
    TotalAverages=TotalAverages+sngStudentAvg
    Then after the loop is done

    Code:
    ClassAverage=Totalaverages/intNumberStudents
    Of course you should define these varaiables or those of your choosing in advance but that is the general idea.

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured