Jump to content

What would be the right calculation for this example?


u0867587
 Share

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

Link to comment
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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • 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.