Jump to content

What would be the right calculation for this example?


u0867587

Recommended Posts

This is a bit of a puzzle. Look at the sum and result below:

 

 $markTotal += ($session['Mark'] / 100 * $session['SessionWeight']);

 

Result on Browser

 

Module: CHI2550 - Modern Database Applications    41.2 (this is $markTotal)

 

Session: AAB        72(this is $session['Mark'])      20% (this is  $session['SessionWeight'])  (The percentage signs are just add ons)

 

Session: AAE        67(this is $session['Mark'])      40%  (this is  $session['SessionWeight'])

 

 

As you can see the answer to the calculation above is right, the answer is 41 .2 as it adds up the two session marks, divide by 100 and then times it by the total amount of the percentage.

 

But I want to include a total mark where except it is out of the total session percentage (60% for above example), it is out of a 100% but I can not work as simple as that as in above example one session is worth more than other. I have worked out that the answer for the total mark of the above example out of 100% should be 69, but how do I achieve this in my calculation.

 

Thank you and any help is much appreciated :)

 

So how

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.