markpete
April 20th, 2009, 09:55 AM
Thank you, problem solved.
|
Click to See Complete Forum and Search --> : VB grade calculator help, please.. markpete April 20th, 2009, 09:55 AM Thank you, problem solved. Shuja Ali April 20th, 2009, 10:50 AM [ Moved to VB.NET ] HanneSThEGreaT April 20th, 2009, 10:55 AM 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 ¿ markpete April 20th, 2009, 11:16 AM 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? DataMiser April 20th, 2009, 04:04 PM 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 TotalAverages=TotalAverages+sngStudentAvg Then after the loop is done ClassAverage=Totalaverages/intNumberStudents Of course you should define these varaiables or those of your choosing in advance but that is the general idea. codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |