# Answer to Question #20585 in C++ for princess

Question #20585
Complete the program below. The objective of the program is to compute grade point average using a weighted average based on Quiz average, Homework average, Test 1 score, Test 2 score and Test 3 score. Notice that quizzes are given a weight of 10%, homework is 15% and test scores are each 25%. These values are stored as constants in the program below.

TIPS:
All constants must be declared globally and do not need to be passed to functions. You will also need to add a program message to the user, check for input errors in main(), and provide comments to the code.

const double QUIZ_WEIGHT = .10;
const double HW_WEIGHT = .15;
const double TEST_WEIGHT = .75;

int main() {
// VARIABLE DECLARATIONS
double quiz_avg, HW_avg, Test1, Test2, Test3;
double max_test, min_test, avg_test, GPA;

//DATA INPUT
cin &gt;&gt;quiz_avg ;
cin &gt;&gt;HW_avg ;
1
2012-12-12T10:54:54-0500
#include <iostream>
#include <stdlib.h>

using namespace std;

int main()
{
const double QUIZ_WEIGHT = 0.10;

const double HW_WEIGHT = 0.15;

const double TEST_WEIGHT = 0.75;

// VARIABLE DECLARATIONS

double quiz_avg, HW_avg, Test1, Test2, Test3;

double max_test, min_test, avg_test, GPA;

//DATA INPUT

cin>>quiz_avg ;
cout<<endl ;

cin>>HW_avg ;
cout<<endl ;

cin >>Test1 ;
cout<<endl ;

cin >>Test2 ;
cout<<endl ;

cin >>Test3 ;
cout<<endl ;
//find min and max
if((Test1>Test2) && (Test1>Test3)) max_test=Test1;
if((Test2>Test1) && (Test2>Test3)) max_test=Test2;
if((Test3>Test1) && (Test3>Test2)) max_test=Test3;

if((Test1<Test2) && (Test1<Test3)) min_test=Test1;
if((Test2<Test1) && (Test2<Test3)) min_test=Test2;
if((Test3<Test1) && (Test3<Test1)) min_test=Test3;

cout<<"max_test= "<<max_test<<endl;

cout<<"min_test= "<<min_test<<endl;
//find avg_test
avg_test=(Test1+Test2+Test3)/3;
cout<<"avg_test="<<avg_test<<endl;
//find GPA
GPA=TEST_WEIGHT*(Test1+Test2+Test3)+HW_WEIGHT* HW_avg+ QUIZ_WEIGHT*quiz_avg;
cout<<"GPA="<<GPA<<endl;

& system("PAUSE");
& return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!