Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C Programming How do I write a program that determines your class grade when tak

ID: 3743753 • Letter: C

Question

C Programming

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. I really do not know how to set this up so any help is greatly appreciated.

Explanation / Answer

ANS:

CODE:

Please find the required C program.

NOTE: The total marks, as not given for exams, are taken to be 100.

//=====================================================

#include<stdio.h>

#define lab 10
#define quiz 10
#define hwrk 10
#define proj 6
#define exam 4

int main()
{
int i;
int lm=0,pm=0,temp1;
float qm=0.0,hm=0.0,em=0.0,temp2;
float final_score=0.0;

//===================================================
// Calculating Marks for Labs
//===================================================

for(i=1;i<=lab;i++)
{
printf(" Please provide the marks for lab %d (out of 100): ",i);
scanf("%d",&temp1);
lm=lm+temp1;
}
// Reduction to 1% x 10 of course grade
final_score = final_score + lm/100.0;

//===================================================
// Calculating Marks for Quizzes
//===================================================

for(i=1;i<=quiz;i++)
{
printf(" Please provide the marks for quiz %d (out of 10): ",i);
scanf("%f",&temp2);
qm=qm+temp2;
}
// Reduction to 1% x 10 of course grade
final_score = final_score + qm/10.0;

//===================================================
// Calculating Marks for Homeworks
//===================================================

for(i=1;i<=hwrk;i++)
{
printf(" Please provide the marks for homework %d (out of 100): ",i);
scanf("%f",&temp2);
hm=hm+temp2;
}
// Reduction to 1% x 10 of course grade
final_score = final_score + hm/100.0;

//===================================================
// Taking input for project marks
//===================================================

printf(" Please provide the marks for project 1 (out of 100): ");
scanf("%d",&pm);
final_score = final_score + (pm*2)/100.0;

printf(" Please provide the marks for project 2 (out of 100): ");
scanf("%d",&pm);
final_score = final_score + (pm*4)/100.0;

printf(" Please provide the marks for project 3 (out of 100): ");
scanf("%d",&pm);
final_score = final_score + (pm*4)/100.0;

printf(" Please provide the marks for project 4 (out of 100): ");
scanf("%d",&pm);
final_score = final_score + (pm*5)/100.0;

printf(" Please provide the marks for project 5 (out of 100): ");
scanf("%d",&pm);
final_score = final_score + (pm*5)/100.0;

printf(" Please provide the marks for project 6 (out of 100): ");
scanf("%d",&pm);
final_score = final_score + (pm*5)/100.0;

//===================================================
// Calculating Marks for Exams
//===================================================

// NOTE: Assuming the exams are grades out of 100

for(i=1;i<=exam-1;i++)
{
printf(" Please provide the marks for exam %d (out of 100): ",i);
scanf("%d",&temp1);
em=em+temp1;
}
// Reduction to 10% x 3 of course grade
final_score = final_score + em/10.0;

// For final exam

printf(" Please provide the marks for exam 4 (out of 100): ");
scanf("%d",&temp1);

final_score = final_score + (temp1*15)/100.0;


printf(" The final score is: %f out of 100 ",final_score);

return 1;
}

//==================================================

Hope this helps!

PLEASE THUMBS UP!!!!!!!!!!

======= sample output ========

Please provide the marks for lab 1 (out of 100): 80

Please provide the marks for lab 2 (out of 100): 80

Please provide the marks for lab 3 (out of 100): 90

Please provide the marks for lab 4 (out of 100): 70

Please provide the marks for lab 5 (out of 100): 90

Please provide the marks for lab 6 (out of 100): 88

Please provide the marks for lab 7 (out of 100): 67

Please provide the marks for lab 8 (out of 100): 85

Please provide the marks for lab 9 (out of 100): 70

Please provide the marks for lab 10 (out of 100): 59

Please provide the marks for quiz 1 (out of 10): 6

Please provide the marks for quiz 2 (out of 10): 7

Please provide the marks for quiz 3 (out of 10): 8

Please provide the marks for quiz 4 (out of 10): 9

Please provide the marks for quiz 5 (out of 10): 10

Please provide the marks for quiz 6 (out of 10): 6

Please provide the marks for quiz 7 (out of 10): 7

Please provide the marks for quiz 8 (out of 10): 8

Please provide the marks for quiz 9 (out of 10): 9

Please provide the marks for quiz 10 (out of 10): 10

Please provide the marks for homework 1 (out of 100): 70

Please provide the marks for homework 2 (out of 100): 60

Please provide the marks for homework 3 (out of 100): 80

Please provide the marks for homework 4 (out of 100): 90

Please provide the marks for homework 5 (out of 100): 98

Please provide the marks for homework 6 (out of 100): 79

Please provide the marks for homework 7 (out of 100): 67

Please provide the marks for homework 8 (out of 100): 79

Please provide the marks for homework 9 (out of 100): 94

Please provide the marks for homework 10 (out of 100): 88

Please provide the marks for project 1 (out of 100): 86

Please provide the marks for project 2 (out of 100): 79

Please provide the marks for project 3 (out of 100): 89

Please provide the marks for project 4 (out of 100): 95

Please provide the marks for project 5 (out of 100): 83

Please provide the marks for project 6 (out of 100): 92

Please provide the marks for exam 1 (out of 100): 87

Please provide the marks for exam 2 (out of 100): 91

Please provide the marks for exam 3 (out of 100): 84

Please provide the marks for exam 4 (out of 100): 78

The final score is: 83.679993 out of 100

THANK YOU