All pastes #709754 Raw Edit

Project 1

public text v1 · immutable
#709754 ·published 2007-09-24 23:01 UTC
rendered paste body



****************************************************************************************/
#include <iostream>
#include <cmath>
using namespace std;

/*******************************************************************************
Description:
    This is a member function that returns the average of the objects grades
Return Value:
    This function returns the variable StudentAverage.  Both Quizzes are worth 20%, the Midterm is 
        worth 20%, and the Final is worth 40% 
*******************************************************************************/

class CGrades	
{
    public:
        CGrades ( );		
        CGrades ( int Quiz1, int Quiz2, int Midterm, int Final );	
        int GetQuiz1 ( );	
        int GetQuiz2 ( );
        int GetMidterm ( );	 
        int GetFinal ( );	
	    void SetQuiz1 ( int Newquiz1 );	
        void SetQuiz2 ( int NewQuiz2 );
        void SetMidterm ( int NewMidterm );
        void SetFinal ( int NewFinal );	
        void Input ( ifstream& Ins );	
        void Output ( ofstream& Outs );	
        double CalculateAverage ( );	
//private member variables as shown below
    private:
        int mQuiz1;	//the grade for the first quiz
        int mQuiz2;	//the grade for the second quiz
        int mMidterm;	//the midterm grade
        int mFinal;	//the final grade	
};        

int main()
{
double CGrades::CalculateAverage ( )
{
     double StudentAverage;
 
     StudentAverage =  ( (mQuiz1 / 10 * .20) + (mQuiz2 / 10 * .20) + 
                       (mMidterm /   100 * .20) + (mFinal / 100 * .40) ) * 100; 

     return StudentAverage;   
}
}