1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
|
#include <iostream>
using std::cout;
using std::cin;
int main()
{
int grade,worth,totalOfGrades,gradeOfTest,gradeOfClass,gradeOfQuiz,gradeOfProject,gradeOfHomeWork, gradeOfTestP,gradeOfClassP,gradeOfQuizP,gradeOfProjectP,gradeOfHomeWorkP,total, resume, testTotal, classTotal, quizTotal, homeworkTotal, projectTotal, average, testAverage, quizAverage, projectAverage, classAverage, homeworkAverage, testNum, projectNum, quizNum, classNum, homeworkNum;
totalOfGrades = 0;
total = 0;
resume = 1;
while(resume != 2)
{
cout << "Please enter a grade number. Then you will be prompted to tell what the grade is worth.\n";
cin>>grade;
cout<< "Please decide what this grade is worth. \n";
cout<< "1. Test \n 2. ClassWork \n 3. Quiz \n 4. Project \n 5. HomeWork \n";
cin>>worth;
if(worth == 1)
{
gradeOfTestP=(grade * .30); //if functions are to tell the percentage of the integer(test, class,quiz, etc.) then multiplies the grade inputted by the decimal value.
gradeOfTest = (100 - gradeOfTestP); //this function actually tells the grade of the test, by subtracting the max score (100) by the percent of how much it's worth to the grade.
total = gradeOfTest + total; //total is to take the grade of the test, and average it all out in the end, this takes ALL the scores entered, adds them, then divides by totalOfGrades.
testTotal = gradeOfTest + testTotal; //testTotal basically takes the grade and adds it to the testTotal.
testNum=(testNum + 1); //testNum adds a number of tests to the amount stored. everytime the statement is used (if) it adds an integer to the counter.
}
else if(worth == 2)
{
gradeOfClassP = (grade * .10);
gradeOfClass = (100 - gradeOfClassP);
total = gradeOfClass + total;
classTotal = grade + classTotal;
classNum = (classNum + 1);
}
else if(worth == 3)
{
gradeOfQuizP = (grade * .20);
gradeOfQuiz = (100 - gradeOfQuizP);
total = gradeOfQuiz + total;
quizTotal = grade + quizTotal;
quizNum = (quizNum + 1);
}
else if(worth == 4)
{
gradeOfProjectP = (grade * .30);
gradeOfProject = (100 - gradeOfProjectP);
total = gradeOfProject + total;
projectTotal = grade + projectTotal;
projectNum = (projectNum + 1);
}
else if(worth == 5)
{
gradeOfHomeWorkP = (grade * .10);
gradeOfHomeWork = (100 - gradeOfHomeWorkP);
total = gradeOfHomeWork + total;
homeworkTotal = grade + homeworkTotal;
homeworkNum = (homeworkTotal + 1);
}
cout << "Do you want to continue inputting grades? \n 1. Yes \n 2. No \n"; //asks the user if they want to continue
cin>>resume;
totalOfGrades = totalOfGrades + 1; //this adds a number to the total number of grades. This may need to be moved somewhere. Not positive.
}
average = (total / totalOfGrades); //these all take the totals of each variable (class, quiz,test, etc.) and divides them by the number of each.
testAverage = (testTotal / testNum);
classAverage = (classTotal / classNum);
quizAverage = (quizTotal / quizNum);
projectAverage = (projectTotal / projectNum);
cout << "Your total average is: "<<total/totalOfGrades<<"\n"; //my math is probably incorrect on a lot of this, can someone help?
cout << "Your total Test Average is: "<<testAverage<<"\n"; //also about declaring if someone has entered no values for a grade type, can someone make a code for me?
cout << "Your total Class Average is: "<<classAverage<<"\n";
cout << "Your total Quiz Average is: "<<quizAverage<<"\n";
cout << "Your total Project Average is: "<<projectAverage<<"\n";
cout << "Your total HomeWork Average is: "<<homeworkAverage<<"\n";
system("pause");
return 0;
}
|