#ifndef STUDENT_H_ #define STUDENT_H_ #include // ------------------------------------------------------------------------- /** * This class represents a single student, or more appropriately, the * record of a single student in a simplified electronic grade book. * * @author Stephen Edwards * @version Feb 22, 2005 */ class Student { public: //~ Constructor ........................................................... // ---------------------------------------------------------- /** * Creates a new Student object. * @param theName the student's name */ Student( std::string theName ); // ---------------------------------------------------------- /** * Destructor. */ virtual ~Student(); //~ Methods ............................................................... // ---------------------------------------------------------- /** * Getter for the student's name property. * @return the student's name */ virtual std::string name() const; // ---------------------------------------------------------- /** * Setter for the student's name property. * @param newName the new value for the student's name */ virtual void setName( const std::string& newName ); // ---------------------------------------------------------- /** * Getter for the number of assignments recorded so far. * @return the number of assignments recorded so far */ virtual int numAssignments() const; // ---------------------------------------------------------- /** * Record the score this student achieved on a new assignment. * @param score the score achieved on this assignment */ virtual void addAssignment( int score ); // ---------------------------------------------------------- /** * Compute the average score on all assignments recorded so far. * @return this student's average score */ virtual int assignmentAverage() const; // ---------------------------------------------------------- /** * Generate a human-readable representation of this student record. * The format is "Student Name (avg)", consisting of the name of * this student record followed by the current assignment average * in parentheses. * @return a string representing this student record */ virtual std::string toString() const; // ---------------------------------------------------------- /** * Check for equality with another Student. * @param rhs the Student to compare with * @return true if this student is equal to the rhs */ bool operator==( const Student& rhs ) const; // ---------------------------------------------------------- /** * Check for difference from another Student. * @param rhs the Student to compare with * @return true if this student is not equal to the rhs */ bool operator!=( const Student& rhs ) const; private: //~ Instance/static variables ............................................. std::string studentName; int numAssigns; int totalPoints; }; #endif /*STUDENT_H_*/