Does anyone know how to complete this problem from my code that I have provided? I know it might not be allowed to post answers on this forum, but any pointers would be helpful, espeically regarding the section where it says "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."
Here's the problem:
Quote:
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 4 homework out of 5 turned in
* 73 58 65 with 8 homework out of 11 turned in
Thank you kindly.Code:#include <stdio.h>
// Function Declarations
char scoreToGrade (int score, int score2, int score3);
int main (void)
{
// Local Declarations
int score;
int score2;
int score3;
char grade;
// Statements
printf("Enter three test scores (0-100): ");
scanf("%d", &score, &score2, &score3);
grade = scoreToGrade (score, score2, score3);
printf("The grade is: %c\n", 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)
{
// Local Declarations
char grade;
char temp;
//Statements
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;
}