Overview For this assignment, expand on the CSCI 240 grade calculator from progr
ID: 3561841 • Letter: O
Question
Overview For this assignment, expand on the CSCI 240 grade calculator from program 1. Instead of asking the user to enter the test average, this program will calculate that average. As with program 1, prompt the user for the program average and save that value in a double/float variable. To calculate the test average, the user will be asked to enter up to 5 extra pieces of information. This means that 5 variables will need to be added to the program. The user should be always be asked for: the sum of the user's test scores (double or float) the maximum test points available (double or float) the number of quizzes that the user has taken (integer) the sum of all of the user's quiz scores (integer) If the user has taken more than two quizzes, they should be asked for: the sum of the user's two lowest quiz scores (integer) After all of the information has been entered, use the new information to calculate the user's test average. If the user has taken more than two quizzes, then the test average is calculated as follows (NOTE: the formula is long. Make sure you're getting the entire formula): (sum of test scores + sum of quiz scores - sum of 2 lowest quiz scores) / (maximum test points available + (10 * (number of quizzes - 2))) * 100 If the user has taken two quizzes or fewer, then the test average is calculated as follows: (sum of test scores + sum of quiz scores) / (maximum test points available + (10 * number of quizzes)) * 100 Use the program average and calculated test average to calculate the final grade for the user. This value should then be displayed as in program 1. Processing Requirements At the top of your C++ source code, include a documentation box that resembles the one from program 1. The float/double values should be displayed with exactly 2 digits after the decimal point. The program average, sum of the user's test scores, maximum test points available, calculated test average, and calculated final grade should be type float or double. The number of quizzes, sum of all of the user's quiz scores, and sum of the user's two lowest quiz scores should be type integer. Make sure to use meaningful variable names. Make sure and test your program with values that you have calculated. Hand in a copy of your source code using Blackboard. Output A few runs of the program should produce the following results: Run 1 Enter the program average: 75.26 Enter the sum of the test scores: 76 Enter the maximum test points available: 100 Enter the number of quizzes that have been taken: 2 Enter the sum of all of the quizzes that have been taken: 17 *************************** Grade Calculator Program Average 75.26 Test Average 77.50 Final Grade 76.72 *************************** Run 2 Enter the program average: 75.26 Enter the sum of the test scores: 76 Enter the maximum test points available: 100 Enter the number of quizzes that have been taken: 5 Enter the sum of all of the quizzes that have been taken: 42 Enter the sum of the two low quiz scores: 13 *************************** Grade Calculator Program Average 75.26 Test Average 80.77 Final Grade 78.84 ***************************
Explanation / Answer
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
int NumPrograms,
Points,
Quizzes,
PointsPoss,
TotalPnts=0,
QuizPnts,
MaxPnts=0,
MaxQuizPoints=0,
Sumtwolowestquizzes,
NumTest,
TotalExamPnts=0,
MaxTestPnts=0,
Exams;
double ExamScore,MaxExamScore,ProgramAvg,QuizAvg,TestAvg,OverTestAvg,CourseAvg;
cout<<"CSCI 240 Grade Calculator"<<endl<<endl;
cout<<"Enter the the number of programs that have been completed ";
cin>> NumPrograms;
for(int i=1; i<=NumPrograms; i++)
{
cout<<"Enter the grade for Program "<<i<<": "<<endl;
cin>>Points;
cout<<"Enter the maximum possible points for Program "<<i<<": "<<endl;
cin>>PointsPoss;
TotalPnts += Points;
MaxPnts += PointsPoss;
}
cout<<endl<<endl<<"Enter the number of quizzes that have been completed ";
cin>>Quizzes;
int i=1;
do
{
cout<<"Enter the grade for Quiz "<<i<<": ";
cin>>QuizPnts;
MaxQuizPoints +=QuizPnts;
i++;
}while (i<= Quizzes);
cout<<"Enter the sum of the two lowest quizzes that have been completed ";
cin>>Sumtwolowestquizzes;
cout<<endl<<endl<<"Enter the number of tests that have been completed ";
cin>>NumTest;
if (NumTest>0)
{
i=1;
while (i<=NumTest)
{
cout<<"Enter the grade for Exam "<<i<<": ";
cin>>ExamScore;
cout<<"Enter the maximum possible points for Exam "<<i<<": ";
cin>>MaxExamScore;
TotalExamPnts += ExamScore;
MaxTestPnts += MaxExamScore;
i++;
}
}
ProgramAvg = TotalPnts/MaxPnts*100;
QuizAvg = (MaxQuizPoints-Sumtwolowestquizzes)/((Quizzes-2)*10)*100;
TestAvg = TotalExamPnts/MaxTestPnts*10;
OverTestAvg = (TotalExamPnts+MaxQuizPoints-Sumtwolowestquizzes)/(MaxTestPnts+((Quizzes-2)*10))*100;
CourseAvg = .4*ProgramAvg + .6*OverTestAvg;
cout<<" | Points Earned Maximum Possible Average "
<<"Program: "<<setw(25)<<TotalPnts<<setw(25)<<MaxPnts<<setw(25)<<ProgramAvg<<endl;
cout<<"Quiz: " <<setw(20)<<MaxQuizPoints-Sumtwolowestquizzes<<setw(20)<<(Quizzes-2)*10<<setw(20)<<QuizAvg<<endl;
cout<<"Test: " <<setw(20)<<TotalExamPnts<<setw(20)<<MaxTestPnts<<setw(20)<<TestAvg<<endl;
cout<<"Test and Quiz: | "
<<"Course: | ";
return 0;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.