Please send questions to st10@humboldt.edu .

/*--------------------------------------------------------
 Header file for class Student with NO explicitly-declared
    destructor, copy constructor, or overloaded assignment
    operator.
 
 created by: Sharon Tuttle
 last modified: 12-2-03
---------------------------------------------------------*/
#include <string>
using namespace std;

class Student
{
    public:
        //-----
        // constructors
        //-----
        Student (string gvn_lastName, string gvn_firstName,
                 int gvn_numGrades);
        Student ();

        //-----
        // accessor functions
        //-----
        string get_lastName() const;
        string get_firstName() const;
        int get_numGrades() const;

        // returns the ith grade for this student
        //    (return -1 if gradesArray NULL or
	//    i is out-of-bounds)
        double get_grade(int i) const;

        //-----
        // mutator functions
        //-----
        void set_lastName(string new_lastName);
        void set_firstName(string new_firstName);

        // note that this also dynamically allocates
	//    a gradesArray of this size...
        void set_numGrades(int new_numGrades);

        // set the ith grade in gradesArray to newGrade
        void set_grade(int i, double newGrade);

        //-----
        // other member functions
        //-----

        //----
        // Contract: avgGrade : void -> double
        // Purpose: returns the average of the grades
        //          in calling Student's gradesArray;
        //          returns -1 if gradesArray == NULL.
        //
        // Examples: for Student emptyStudent(); :
        //              emptyStudent.avgGrade() == -1
        //           for Student exStudent("Geo", "Jon", 3);
        //              with grades 100, 80, 75,
        //              exStudent.avgGrade() == 85
        //----- 
        double avgGrade() const;

        //-----
        // Contract: hasHigherAvgThan : Student -> bool
        // Purpose: returns true if calling Student has
        //          an average grade higher than 
        //          otherStudent; returns false otherwise.
        //
        // Examples: if Student student1("A", "A", 3)
        //              has grades 100, 80, 75,
        //           Student student2("B", "B", 4)
        //              has grades 80, 80, 90, 90, and
        //           Student student3("C", "C", 3)
        //              has grades 86, 87, 88,
        //           then:
        //   student1.hasHigherAvgThan(student2) == false
        //   student3.hasHigherAvgThan(student2) == true
        //   student1.hasHigherAvgThan(student3) == false
        //-----
        bool hasHigherAvgThan(Student otherStudent) const;

    private:
        // member variables
	string lastName;
	string firstName;
	int    numGrades;
        double *gradesArray;
};