Answer:
Replace
/* Your solution goes here */
with
sumExtra = 0;
for (i =0; i<NUM_VALS;i++){
if(testGrades[i]>100){
sumExtra = sumExtra - testGrades[i] + 100;
}
}
Explanation:
This line initializes sumExtra to 0
sumExtra = 0;
The following is a loop from 0 to 3
for (i =0; i<NUM_VALS;i++){
The following if condition checks if current array element is greater than 100
if(testGrades[i]>100)
{
This line calculates the extra credit
sumExtra = sumExtra - testGrades[i] + 100;
}
}
See attachment for complete question