Write an algorithm to calculate a grade for a class given the following requirem
ID: 3820663 • Letter: W
Question
Write an algorithm to calculate a grade for a class given the following requirements:
There are three tests;
Test 1 has a maximum of 100 points and is worth 10% of the grade
Test 2 has a maximum of 100 points and is worth 15% of the grade
Final test has a maximum of 200 points and is worth 25% of the grade
There are six homework assignments;
Each assignment has a maximum of 50 points
The highest four assignment grades are used and each is worth 12% of the grade
All six homework assignments must be submitted;
if one assignment is missing, then the 4 highest assignments are each worth 11.5%
if two are missing, then the 4 highest assignments are each worth 10%
if three or more are missing, then the 4 highest assignments are each worth 7.5%
There are two quizzes
Each quiz has a maximum of 10 points and each is worth 1% of the grade
Print the final grade
Explanation / Answer
get_top_four_grade(HW[])
if size hw == 5:
multiplier = .115
if size hw == 4
multiplier = .10
if size hw <= 3
multiplier = .075
return sum_highest_four_hw*multiplier
CalcGrade:
total = .1*test1 + .15*test2 + .25*finalTest
sum_top_four_hw = find_top_fourAssignment_sum(hw1, hw2, hw3, hw4, hw5, hw6)
total = total + get_top_four_grade
total = total + (qz1 + qa2)*.1
print total
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.