How do make this calculation to achieve the answer I want?
<p>This is a bit of a puzzle. Look at the sum and result below:</p>

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

<p>Result on Browser:</p>

<blockquote>
  <p>Module: CHI2550 - Modern Database Applications     41.2 (this is $markTotal)</p>
  
  <p>Session: AAB        72(this is $session['Mark'])      20% (this is  $session['SessionWeight'])</p>
  
  <p>Session: AAE        67(this is $session['Mark'])      40%  (this is  $session['SessionWeight'])</p>
</blockquote>

<p>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.</p>

<p>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.</p>

<p>Thank you and any help is much appreciated :)</p>
