How do I write a program that determines your class grade when taking into accou
ID: 3743935 • Letter: H
Question
How do I write a program that determines your class grade when taking into account test scores, hw scores, labs, quizzes, and projects. Some of these are weighted differently too, below is how they are supposed to be weighted in the program: 10 labs, each lab 1% of course grade, labs are out of 100 points, with a integer score type. 10 quizzes, each quiz is 1% of course grade, quizzes are out of 10 points, have a real number score type. 10 homeworks, each is 1% of course grade, each hw is out of 100 points, have a real number score type. 6 projects(this is the part i am struggling to know how to set up) project 1 is 2% of grade. projects 2 and 3 are 4% of grade each. Finally projects 4, 5, and 6 are 5% of grade each. Projects are graded out of 100 points and are integer score type. 4 Exams. 10% each of grade for exams 1, 2, and 3. 15% for final exam. All in all, the completed program should ask me to type in my scores for each subject (hw, quizzes, labs, projects, exams) and then generate my final grade for the semester. THE OUTPUT HAS TO HAVE 6 LINES: 5 QUESTIONS and THE FINAL AVERAGE. SO IT IS ASKING ME TO TYPE IN ALL MY SCORES ON ONE LINE FOR EXAMPLE: "ENTER 10 LAB SCORES" THEN I TYPE: "99 100 20 30 40 50 55 66 99 89". I really do not know how to set this up so any help is greatly appreciated.
C PROGRAMMING NOT C++
Explanation / Answer
#include <stdio.h>
int main(void) {
int i,lab[10],proj[6];
float quiz[10],hw[10],exam[4];
float average = 0;
printf("Enter scores in 10 labs out of 100 points : ");
for(i=0;i<10;i++)
{
scanf("%d",&lab[i]);
average = average + lab[i]*1.0/100;
}
printf(" Enter scores in 10 quizzes out of 10 points : ");
for(i=0;i<10;i++)
{
scanf("%f",&quiz[i]);
average = average + quiz[i]*1.0/100;
}
printf(" Enter scores in 10 homeworks out of 100 points : ");
for(i=0;i<10;i++)
{
scanf("%f",&hw[i]);
average = average + hw[i]*1.0/100;
}
printf(" Enter scores in 10 projects out of 100 points : ");
for(i=0;i<10;i++)
scanf("%d",&proj[i]);
average = average + proj[0]*2.0/100 + proj[1]*4.0/100 + proj[2]*4.0/100 + proj[3]*5.0/100 + proj[4]*5.0/100 + proj[5]*5.0/100 ;
printf(" Enter scores in 4 exans out of 100 points : ");
for(i=0;i<10;i++)
scanf("%f",&exam[i]);
average = average + exam[0]*10.0/100 + exam[1]*10.0/100 + exam[2]*10.0/100 + exam[0]*15.0/100 ;
printf(" The Final Average = %.2f",average);
return 0;
}
Output:
Enter scores in 10 labs out of 100 points :67 89 75 69 56 77 88 91 73 87
Enter scores in 10 quizzes out of 10 points :6.6 7.1 5.6 8.2 5.9 9.1 6.6 5.9 6.4 7.3
Enter scores in 10 homeworks out of 100 points :63.6 89.8 75.3 68.6 59.1 71.6 84.4 92.1 78.4 87.3
Enter scores in 10 projects out of 100 points :67 89 75 69 56 77 88 91 73 87
Enter scores in 4 exans out of 100 points :68.7 62.5 78.4 86.9
The Final Average = 65.37
Do ask if any doubt. Please upvote.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.