/* CREATE A NEW FOLDER called "TestOne"
and create a new PROJECT in it called "TestOne"
Then COPY this file into it, and complete the THREE public functions.
NAME:
DATE:
----- this is the programming portion of test #1 in C++ ------
*/
#include <iostream>
class Success
{
public:
Success(); // default constructor to initialize private variables to 0
void printAverage() // prints "No average." if no grades, otherwise prints the average
// do NOT worry about rounding!!
void addToGrades(int); // call the parameter newGrade and update private data as needed
private:
int totalPoints; // tracks the total points this person has
int numberOfGrades; // tracks the total number of grades this person has
};
//=====================================================
//-----DEFINE YOUR FUNCTIONS IN HERE------------------
//-----END OF FUNCTION DEFINITION AREA-----------------
//=====================================================
int main()
{
int numGrades = 5;
int grades[numGrades]; //create an array of numbers
// 5 lines below fill the array
grades[0] = 80;
grades[1] = 82;
grades[2] = 85;
grades[3] = 88;
grades[4] = 90;
Success youAre;
cout << "Your current average is: ";
youAre.printAverage(); // Should print "No grades entered yet.";
for(int i = 0; i < numGrades; i++)
youAre.addToGrades(grades[i]); // adds each grade to the youAre object
cout << "Your current average is: ";
youAre.printAverage(); // Should print "85"
return 0;
}