So I have a coding project where I have to calculate the overall grade of a student in a class where they have 4 quizzes, 2 midterms, and 1 final exam. The quiz and exam are weighted 30% and the midterm 40%. I just help with 2 things:
- My code doesn't want to start w/o having 4 individual input numbers (79 80 0 0).
- When getting to the exam part of the code, it for some reason bypasses the needed user input and autos it to the 3rd number in the quiz coding. I'm coding in c programming.
#include <stdio.h>
int main()
{
int testOne, testTwo;
float totTest, percTest, testPoint;
printf("Enter you test grades:\n");
scanf("%d%d\n",&testOne,&testTwo);
totTest=testOne+testTwo;
printf("Your total grade points is: %.1f\n", totTest);
testPoint=200;
percTest=(totTest*.40)/testPoint *100;
printf("Your percentage is %.1f%\n", percTest);
int quizOne, quizTwo, quizThree, quizFour;
float totQuiz, percQuiz, quizPoint;
printf("Enter you quiz grades:\n");
scanf("%d%d%d%d\n", &quizOne, &quizTwo, &quizThree, &quizFour);
totQuiz=quizOne+quizTwo+quizThree+quizFour;
printf("Your total quiz grade is %.1f\n", totQuiz);
quizPoint=400;
percQuiz=(totQuiz*.30)/quizPoint *100;
printf("Your quiz percentage is %.1f%\n", percQuiz);
int examOne, examPoint; <This is the code that automatically messes up>
float percExam, finGrade;
printf("Enter your exam grade\n");
scanf(" %d\n", &examOne);
examPoint=100;
percExam=(examOne*.30)/examPoint *100;
printf("Your final exam grade is %.1f\n", percExam);
finGrade=(percExam+percQuiz+percTest);
printf("Your overall grade is %.1f%\n", finGrade);
return 0;
}