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.
//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
1
Expert's answer
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
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;
Comments
Leave a comment