<u>Answer:</u>
I am writing <em>partial code in</em> <em>c++ to calculate weighted average</em>. The weighted average should be calculated based on multiplying the test score and its <em>respective weight and finally add all the test score.</em>
<u>Explanation:</u>
<em>int arrtestscore[100];</em>
<em>int arrweight[100];</em>
<em>int n;</em>
<em>double weightedavg;</em>
<em>cout<<”Enter the number of test score for which weighted average needs to be calculated”;</em>
<em>cin>>n;</em>
<em>for(int x = 0; x <n;x++)</em>
<em>{</em>
<em> cout<<”Enter test score :” + (x+1) ;</em>
<em> cin>>arrtestscore[x];</em>
<em> count<<”Enter the respective weight:”;</em>
<em> cin>>arrweight[x];</em>
<em>}</em>
<em>for (int i=0; i<n;i++)</em>
<em>{</em>
<em> weightedavg = weightedavg + (arrtestscore[i] * arrweight[i])</em>
<em>}</em>
<em>cout<<”weighted average = “ <<weightedavg; </em>