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