#include#include using namespace std; int main() { int programs; double points,m
ID: 441876 • Letter: #
Question
#include#include using namespace std; int main() { int programs; double points,max,TtlPoints=0,MaxPoints=0,average; //get valid program # do { cout<<"Enter number of porgrams completed during the semester: "; cin>>programs; if(programs<0){ cout<<"The number of program must be positive. "; } }while(programs<0); //get input for(int i=0;i<<"Enter points received for program #"<<i+1<<": "; cin>>points; cout<<"Enter max points for program #"<<i+1<<": "; cin>>max; TtlPoints+=points; MaxPoints+=max; } if(programs==0) average=0; else average=(100.*TtlPoints)/MaxPoints; cout<<"The program average is "<<average<<"%. "; system("pause"); return 0; } { int quizzes; i=0; double points,max,TtlPoints=0,MaxPoints=0,average=0,TwoLowestSum=0; //get valid quiz # do{ cout<<"Enter number of quizzes completed during the semester: "; cin>>quizzes; if(quizzes<0){ cout<<"The number of quiz must be positive. "; } }while(quizzes<0); if(quizzes>0){ do{ cout<<"Enter points received for quiz #"<<i+1<<": "; cin>>points; TtlPoints+=points; i++; }while(i2){ cout<<"Enter sum of the two lowest quiz: "; cin>>TwoLowestSum; } } MaxPoints=(quizzes-2)*10; if(quizzes!=0) average=100.*(TtlPoints-TwoLowestSum)/MaxPoints; cout<<"The quiz average( excluding two lowest score) is "<<average<<"%. "; system("pause"); return 0; } int tests,i=0; double points,max,TtlPoints=0,MaxPoints=0,average=0,TwoLowestSum=0; { //get valid test # do{ cout<<"Enter number of tests completed during the semester: "; cin>>tests; if(tests<0){ cout<<"The number of test must be positive. "; } }while(tests<0); if(tests>0){ do{ cout<<"Enter points received for test #"<<i+1<<": "; cin>>points; TtlPoints+=points; i++; }while(i=2){ cout<<"Enter sum of the two lowest test: "; cin>>TwoLowestSum; } } MaxPoints=(tests-2)*10; if(tests==0) average=0; else average=100.*(TtlPoints-TwoLowestSum)/MaxPoints; cout<<"The test average( excluding two lowest score) is "<<average<<"%. "; system("pause"); return 0; }Explanation / Answer
#include
#include
using namespace std;
int main() {
int programs;
double points,max,TtlPoints=0,MaxPoints=0,average; //get valid program #
do {
cout<<"Enter number of porgrams completed during the semester: ";
cin>>programs;
if(programs<0)
cout<<"The number of program must be positive. ";
}while(programs<0); //get input
for(int i=0;i<10;i++){
cout<<"Enter points received for program #"<<i+1<<": ";
cin>>points;
cout<<"Enter max points for program #"<<i+1<<": ";
cin>>max;
TtlPoints+=points;
MaxPoints+=max;
}
if(programs==0)
average=0;
else
average=(100.*TtlPoints)/MaxPoints;
cout<<"The program average is "<<average<<"%. ";
system("pause");
return 0;
}
-------------------------------------------------------------------------
{
int quizzes;
i=0;
double points,max,TtlPoints=0,MaxPoints=0,average=0,TwoLowestSum=0; //get valid quiz #
do{
cout<<"Enter number of quizzes completed during the semester: ";
cin>>quizzes;
if(quizzes<0){
cout<<"The number of quiz must be positive. ";
}
}while(quizzes<0);
if(quizzes>0){
do{
cout<<"Enter points received for quiz #"<<i+1<<": ";
cin>>points;
TtlPoints+=points;
i++;
}while(i2){
cout<<"Enter sum of the two lowest quiz: ";
cin>>TwoLowestSum;
}
}
MaxPoints=(quizzes-2)*10;
if(quizzes!=0)
average=100.*(TtlPoints-TwoLowestSum)/MaxPoints;
cout<<"The quiz average( excluding two lowest score) is "<<average<<"%. ";
system("pause");
return 0;
}
-----------------------------------------------------------------
int tests,i=0;
double points,max,TtlPoints=0,MaxPoints=0,average=0,TwoLowestSum=0; { //get valid test #
do{
cout<<"Enter number of tests completed during the semester: ";
cin>>tests; if(tests<0){
cout<<"The number of test must be positive. ";
}
}while(tests<0);
if(tests>0){
do{
cout<<"Enter points received for test #"<<i+1<<": ";
cin>>points;
TtlPoints+=points;
i++;
}while(i=2)
cout<<"Enter sum of the two lowest test: ";
cin>>TwoLowestSum;
}
MaxPoints=(tests-2)*10;
if(tests==0)
average=0;
else
average=100.*(TtlPoints-TwoLowestSum)/MaxPoints;
cout<<"The test average( excluding two lowest score) is "<<average<<"%. ";
system("pause");
return 0;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.