Problem E2 Write a program that determines a student\'s letter grade. Allow the
ID: 3668882 • Letter: P
Question
Problem E2 Write a program that determines a student's letter grade. Allow the user to enter three test scores. The maximum score on each test is 100 points. Determine the letter grade from the average of the test scores, using the following: 90% or more A 80% or more, but less than 90% B 70% or more, but less than 80% C 60% or more, but less than 70% D or F, to be determined from additional information less than 60% F Only if the grade needs to be determined between D and F, allow the user to enter the number of homework assignments the student turned in, and the total number of homework assignments. If more than 80% of the homework assignments were turned in, the letter grade is D, otherwise F. Test it 4 times: 96 84 90 95 83 90 70 59 60 with 5 homework out of 6 turned in 73 58 65 with 8 homework out of 11 turned in Compute the results by hand and check your results.
Explanation / Answer
#include <stdio.h>
char scoreToGrade (int score, int score2, int score3);
int main (void)
{
int score,score2,score3;
char grade;
printf("Enter three test scores (0-100): ");
scanf("%d", &score, &score2, &score3);
grade = scoreToGrade (score, score2, score3);
printf("The grade is: %c ", grade);
int temp;
printf("Enter an integer and press Enter to exit the program: ");
scanf("%d", &temp);
return 0;
}
char scoreToGrade (int score, int score2, int score3)
{
char grade;
char temp;
temp = score / 10;
switch (temp)
{
case 10:
case 9 : grade = 'A';
break;
case 8 : grade = 'B';
break;
case 7 : grade = 'C';
break;
case 6 : grade = 'D';
break;
default: grade = 'F';
}
return grade;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.