Problem 4: The overall grade in a course is determined from the grades of 5 quizzes, 3 midterms, and a final, using the following scheme:
Quizzes: Quizzes are graded on a scale from 0 to 10. The grade of the lowest quiz is dropped and the average of the 4 quizzes with the higher grades constitutes 25% of the course grade.
Midterms: Midterms are graded on a scale from 0 to 100. If the average of the midterm scores is higher than the score on the final, the average of the midterms is 35% of the course grade. If the final grade is higher than the average of the midterms, then the lowest midterm is dropped and the average of the two midterms with the higher grades is 35% of the course grade.
Final: Finals are graded on a scale from 0 to 10. The final is 40% of the course grade. Write a computer program in a script file that determines the course grade for a student. The program first asks the user to enter the five quiz grades (in a vector), the three midterm grades (in a vector), and the grade of the final. Then the program calculates a numerical course grade (a number between 0 and 100). Finally, the program assigns a letter grade according to the following key:
A for grade >= 90, B for 80<= grade <= 90, C for 70 <= grade <= 80, D for 60 <= grade <= 70, and E for a grade lower than 60. Execute the program for the following cases:
(a) Quiz grades: 7, 9, 4, 8 , 7. Midterm grades: 93, 83, 87. Final grade: 89.
(b) Quiz grades: 8, 6, 9, 6 , 9. Midterm grades: 81, 75, 79. Final grade: 72.
I keep getting an error when trying to use if and else to create a scheme for the Midterms. I have attached two pics (input and output) to display an example of my issue.
Best Answer