64 679
Assignments Done
99,2%
Successfully Done
In September 2018

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
cout << "Please enter your quiz average: " ;
cin >>quiz_avg ;
cout << "Please enter your Homework average: " ;
cin >>HW_avg ;
cout << "Please enter your scor
Expert's answer
#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

cout<< "Please enter your quiz average: "<<endl ;
cin>>quiz_avg ;
cout<<endl ;

cout<<& "Please enter your Homework average: "<<endl ;
cin>>HW_avg ;
cout<<endl ;

cout <<& "Please enter your mark for Test1"<<endl;
cin >>Test1 ;
cout<<endl ;


cout <<& "Please enter your mark for Test2"<<endl;
cin >>Test2 ;
cout<<endl ;


cout <<& "Please enter your mark for Test3"<<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!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions