The input consists of
In general a weighted average portion of the grade is calculated by $\frac{\text{points earned}}{\text{total points}} \times \text{weight}$. So if a person earned 35 points for homework out of a total of 40, and homework was worth 10% (0.1), the home points would be $\frac{35}{40}\times 0.1 = 0.0875$
For tests, assume that the average has been computed so the input value must be multiplied by the weight.
The final average is found by summing all of the weighted averages and dividing by the sum of the weights. This will allow for computation of the grade when a portion, such as the final exam, is missing. The user just supplies a 0, 0 for the last two inputs.
An example run should look like:
Enter the points earned on homework => 80 Enter the total homework points available => 100 Enter the weight of the homework => .1 Enter the points earned on program => 90 Enter the total program points available => 100 Enter the weight of the program => .45 Enter the test average => .85 Enter the test weight => .3 Enter the final exam score => .95 Enter the final exam weight => .15 Averages Homework: 80% Program: 90% Test: 85% Final Exam: 95% The class average is 88%
Set tempTotal to 0 set totalWeight to 0 Compute the weighted average of for the homework with Average1 Compute the weighted average of the programs with Average1 Compute the weighted average of the tests with Average2 Compute the weighted average of the final with Average2 Compute final average = tempTotal / totalWeight Print Results -------------------- Average1 Ask for the points earned for the item. Ask for the total points for the item. Ask for the weight of the item. compute itemAverage = points earned / total points compute itemCotrib = itemAverage * itemWeight add itemContrib to tmpTotal add itemWeight to totalWeight Average 2 Ask for the average for the item. Ask for the weight for the item. compute itemCotrib = itemAverage * itemWeight add itemContrib to tmpTotal add itemWeight to totalWeight