# What would be the right calculation for this example?

## 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

##### Share on other sites

This thread is more than a year old. Are you sure you have something important to add to it?

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

×   Pasted as rich text.   Restore formatting

Only 75 emoji are allowed.