Forum Moderators: open
Here's what I'm wanting to do:
I'm wanting to create a calculator inside the program I'm using that will take the scores from A [sections 1-3] and average them out so I can take the variable and let them see that they passed chapter A. Can I get some help with this? I am VERY new to Javascript/AJAX/PHP coding but I can understand the terms/concepts of it.
Is there a way to do this?
Take the following example: 74% test1, 74% test2, 100% test3. The average will be a randomish number above 75%, even though they failed the first two.
You have to examine each section of part A and perform logical ANDs on them.
For instance: if (a1>=.75 && a2>=.75 && a3>=.75){
a_pass=1;}
While the others would just be
if (b>=.75}{}
if (c>=.75}{}
if for whatever reason I misunderstood you, and you still need to find the average, just take the sum of the variables, and divide it by the number of variables.
[edited by: Xapti at 4:41 pm (utc) on July 24, 2007]
Does this make sense?
______________________________________________________
You can't see if a person passed all 3 just by looking at their average.
I assume when you say 75% is the lowest possible score, you mean it is the passing score, right?
Take the following example: 74% test1, 74% test2, 100% test3. The average will be a randomish number above 75%, even though they failed the first two.
You have to examine each section of part A and perform logical ANDs on them.
For instance: if (a1>=.75 && a2>=.75 && a3>=.75){
a_pass=1;}
While the others would just be
if (b>=.75}{}
if (c>=.75}{}
if for whatever reason I misunderstood you, and you still need to find the average, just take the sum of the variables, and divide it by the number of variables.
take your variables, a1, a2, a3, lets say, and add them: a1+a2+a3
then divide them by three (the number of variables), The final result looking like this:
average=(a1+a2+a3)/3
The average value will not be able to tell you whether or not they've passed or failed any of their tests though.
Int TotalOne=A1
Int TotalTwo=A2
Int TotalThree=A3
TotalOne+TotalTwo+TotalThree=CombinedTotal
CombinedTotal/3
And that still doesn't change the average percentage of what the person scored. I just need a way to change "CombinedTotal" into a number that will show up as a percent. Then my program will show that they passed.
Make sense? I get the feeling you're misunderstanding me.
*Edit* My mistake. The code is C# I believe.
___________________________________________________________
It's basic math you learn on like grade 5-10 (I guess depending on the school system)...
as I mentioned "if for whatever reason I misunderstood you, and you still need to find the average, just take the sum of the variables, and divide it by the number of variables. ":
take your variables, a1, a2, a3, lets say, and add them: a1+a2+a3
then divide them by three (the number of variables), The final result looking like this:
average=(a1+a2+a3)/3
The average value will not be able to tell you whether or not they've passed or failed any of their tests though.
[edited by: Negami at 10:00 pm (utc) on July 26, 2007]