write a program that will compute your average in a class course, based on the a
ID: 3627232 • Letter: W
Question
write a program that will compute your average in a class course, based on the amount of work graded at any time you run your program. this is the grading scale
grading system:
2 quizzes - 10 %
2 exams - 50 %
12 programs - 40 % (the best 10 program scores will count)
set grading scale
90-100% - A
88-89% - A-
86-87% - B+
80-85 %- B
78-79%- B-
76-77%- C+
70-75%- C
68-69%- C-
66-67%- D+
60-65%- D
58-59%- D-
below 58%- F
your average will be computed using the following algorithm:
!. calculate the average of the exams taken (each worth 100 points)
2. calculate the average of the quiz scores (each worth 25 points)
3. add the program assignment scores (each is worth 50), then determine the two lowest program scores and subtract this number from the program scores total. calculate the averaga of the remaining program assignments scores.
4. calculate the weighed average. weighed average = (exam average*0.5)+(quiz average*0.10)+(program average*0.4)
use this to determine your percentage grade from the set grade scale above:
your program must prompt the user for the info needed to perform the calculations in the algorithm. this infor mation consists of :
the number of exams taken
for each exam, the scores of the exam,
the number of quixes taken
for each quiz, the score of the quiz
the number of graded program assignments returned,
for each program, the score of the program.
you will need arrays to store the data scores. use arrays of size 2 for the test and quiz scores and an array of size 12 to score the program scores.
name the program program7.c and compile using gcc program7.c -o runit.
**ps. please use the most basic of C programming rules and functions. nothing too intense
Explanation / Answer
please rate - thanks
#include <stdio.h>
#include <conio.h>
int main()
{
int i,j;
int quiz[2],exam[2],prog[12],numq,nume,nump,t;
double avge,avgq,avgp,avg;
int sum;
char letter;
printf("Enter number of quizzes taken ");
scanf("%d",&numq);
sum=0;
for(i=0;i<numq;i++)
{printf("Enter quiz %d grade(0-25): ",i+1);
scanf("%d",&quiz[i]);
sum+=quiz[i];
}
avgq=(double)sum/numq;
sum=0;
printf("Enter number of exams taken ");
scanf("%d",&nume);
for(i=0;i<nume;i++)
{printf("Enter exam %d grade(0-100): ",i+1);
scanf("%d",&exam[i]);
sum+=exam[i];
}
avge=(double)sum/nume;
sum=0;
printf("Enter number of programs written ");
scanf("%d",&nump);
for(i=0;i<nump;i++)
{printf("Enter program %d grade(0-50): ",i+1);
scanf("%d",&prog[i]);
sum+=prog[i];
}
for(i=0;i<nump-1;i++)
for(j=i;j<nump;j++)
if(prog[i]>prog[j])
{t=prog[i];
prog[i]=prog[j];
prog[j]=t;
}
avgp=(double)(sum-(prog[0]+prog[1]))/(nump-2);
avg=(avge*.5)+avgq*.1+avgp*.4;
printf("Your grade is ");
if(avg>=90)
printf("A ");
else if(avg>=88)
printf("A- ");
else if(avg>=86)
printf("B+ ");
else if(avg>=80)
printf("B ");
else if(avg>=78)
printf("B- ");
else if(avg>=76)
printf("C+ ");
else if(avg>=70)
printf("C ");
else if(avg>=68)
printf("C- ");
else if(avg>=66)
printf("D+ ");
else if(avg>=60)
printf("D ");
else if(avg>=58)
printf("D- ");
else
printf("F ");
getch();
return 0;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.