Programs
Handle the programs next. Ask the user to enter the number of programs that have been completed during the semester. Write a for loop that will execute "number of programs" number of times. It will calculate the total number of program points and maximum number of program points available. The body of the for loop should:
prompt the user for a single program score. This prompt should include the program number.
prompt the user for the maximum possible score for the single progam
add the single program score to the total program points earned
add the maximum possible program score to the total program points available
If programs have been turned in during the semester, calculate the program average using the formula:
Program average = total program points / maximum program points possible * 100
If no programs have been turned in at this point of the semester, set the program average to 0.0.
Quizzes
Quizzes are next. Ask the user to enter the number of quizzes that have been taken during the semester. If the number of quizzes is greater than 0, write a do...while loop that will calculate the total number of quiz points. The body of the loop should:
prompt the user for a single quiz score. This prompt should include the quiz number.
add the single quiz score to the total quiz points earned
If more than 2 quizzes were taken, ask the user for the sum of the two lowest quiz scores and calculate the maximum possible quiz points using the formula:
Maximum Possible Quiz Points = (number of quizzes - 2) * 10
If 2 or fewer quizzes were taken, set the sum of the two lowest quizzes to 0 and calculate the maximum possible quiz points using the formula:
Maximum Possible Quiz Points = number of quizzes * 10
Use the sum of the two lowest quiz scores and the maximum possible quiz points to calculate the quiz average using the formula:
Quiz Average = (total quiz points - sum of the two lowest quiz scores) / Maximum Possible Quiz Points * 100
If no quizzes have been taken at this point in the semester, set the quiz average to 0.0.
Tests
Finally to the tests. Ask the user to enter the number of tests that have been taken during the semester. If the number of tests that have been taken is greater than 0, then write a while loop that will execute "number of tests" number of times and calculate the total number of test points and maximum number of test points available. The body of the loop should:
prompt the user for a single test score. This prompt should include the test number.
prompt the user for the maximum possible score for the single test
add the single test score to the total test points earned
add the maximum possible score to the total test points available
If tests have been taken during the semester, calculate the test average using the formula:
Test average = total test points / maximum test points possible * 100
If no tests have been taken at this point of the semester, set the test average to 0.0.
Quizzes and Tests
The quiz scores and test scores are combined into an overall test average that is used to calculate the average for the course. If tests or quizzes have been taken during the semester, then calculate the overall test average using the formula:
Overall Test Average = (total test points + total quiz points - sum of the two lowest quiz scores) / (maximum test points possible + Maximum Possible Quiz Points) * 100
If no quizzes and tests have been taken at this point in the semester, set the overall test average to 0.0.
Course Average
The course average is the weighted average of the program and overall test averages. The programs are weighted at 40% and the overall tests are weighted at 60%.
Code:
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
float Programs,ProgramEarnedsum,ProgramWorthsum,ProgramAvg,Programgrade,Programtotal,QuizAvg2,QuizAvg1,Qui zzes,LowQuizzes,Qearned;
int QuizEarnedsum,QuizWorthsum;
float tests,Tearned,TestMax,TestEarnedsum,TestWorthsum,TestAvg,OverTestAvg,CourseAvg;
ProgramEarnedsum=0;
ProgramWorthsum=0;
QuizEarnedsum=0;
QuizWorthsum=0;
TestEarnedsum=0;
TestWorthsum=0;
cout<<"Enter number of programs completed during the semester: ";
cin>>Programs;
for(int i=0;i<Programs;i++)
{
cout<<"Enter points received for program #"<<i+1<<": ";
cin>>Programgrade;
cout<<"Enter max points for program #"<<i+1<<": ";
cin>>Programtotal;
ProgramEarnedsum+=Programgrade;
ProgramWorthsum+=Programtotal;
ProgramAvg=(Programgrade*Programs)/(Programtotal*Programs)*100;
}
do{
cout << "Enter the total number of quizzes that have been taken during the semester: "<<endl;
cin>>Quizzes;
}while (Quizzes<0);
for (int i=0;i<Quizzes;i++)
{
cout<<"Enter points received for Quiz #"<<i+1<<": ";
cin>>Qearned;
QuizWorthsum=(Quizzes*10);
QuizEarnedsum+=Qearned;
if (Quizzes<=2){
LowQuizzes=0.0;}
if (Quizzes=0){
QuizAvg2=0.0;}
}
if (Quizzes>2){
cout<<"Enter the sum of lowest quizzes: ";
cin>>LowQuizzes;
QuizWorthsum=(Quizzes-2)*10;
QuizAvg2=(QuizEarnedsum*Quizzes-LowQuizzes)/(QuizWorthsum*100);}
{
cout<<"Enter the number of Tests: ";
cin>>tests;
}while(tests<0);
for(int t=0;t<tests;t++){
cout<<"EnterPoints receieved for Test #"<<t+1<<": ";
cin>>Tearned;
cout<<"Enter max points for Test #"<<t+1<<": ";
cin>>TestMax;
TestEarnedsum+=Tearned;
TestWorthsum+=TestMax;
TestAvg=(Tearned*tests)/(TestMax*tests)*100;
}
if (tests=0)
TestAvg=0;
if (tests>0&&Quizzes>0)
{
OverTestAvg=(TestEarnedsum+QuizEarnedsum-LowQuizzes)/(TestWorthsum+QuizWorthsum)*100;
}
if (tests=0 && Quizzes>1)
{
OverTestAvg==0.0;
}
CourseAvg=OverTestAvg*0.6+ProgramAvg*0.4;
cout<<endl;
cout<<endl;
cout<<endl;
cout<<"PointEarnedPrograms: "<<ProgramEarnedsum<<endl;
cout<<"Maxium Possible: "<<ProgramWorthsum<<endl;
cout<<"ProgramAvg: "<< fixed << setprecision(2)<<ProgramAvg<<endl;
cout<<"Quiz Points Earned: "<<QuizEarnedsum<<endl;
cout<<"Quiz Max worth: "<<QuizWorthsum<<endl;
cout<<"Quiz avg: "<<fixed << setprecision(2) <<QuizAvg2<<endl;
cout<<"Test: "<< setiosflags( ios:: fixed ) << setprecision(2) <<TestEarnedsum<<endl;
cout<<"TEST WORTH: "<<TestWorthsum<<endl;
cout<<"TEST AVG: "<<TestAvg<<endl;
cout<<endl;
cout<<"Test and Quizzes: "<<setiosflags( ios:: fixed ) << setprecision(2) <<OverTestAvg<<endl;
cout<<"Course: "<<CourseAvg<<endl;
return 0;
}
Any help would be appreciated, im very new to c++ and this program has be going crazy,after putting countless hours into it already.
My major problems is when an input is 0 it makes the averages all set to 0 and i dont know how to fix that. Thanks in advance for any help