Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Finally to the tests. Ask the user to enter the number of tests that have been t

ID: 441773 • Letter: F

Question

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.

Explanation / Answer

//woops pasted wrong code. Ignore the one about test and TwoLowest Sum

//this is correct one


#include<iostream>

#include<cstdlib>

using namespace std;


int main(){

int programs;

double points,max,TotalPoints=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<programs;i++){

cout<<"Enter points received for program #"<<i+1<<": ";

cin>>points;


cout<<"Enter max points for program #"<<i+1<<": ";

cin>>max;


TotalPoints+=points;

MaxPoints+=max;

}



if(programs==0)

average=0;

else

average=(100.*TotalPoints)/MaxPoints;


cout<<"The program average is "<<average<<"%. ";

system("pause");

return 0;


}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote