#include #include "Student.h" using std::string; //------------------------------------------------------------------------- Student::Student( string theName ) { studentName = theName; numAssigns = 0; totalPoints = 0; } //------------------------------------------------------------------------- Student::~Student() { } //------------------------------------------------------------------------- string Student::name() const { return studentName; } //------------------------------------------------------------------------- void Student::setName( const string& newName ) { studentName = newName; } //------------------------------------------------------------------------- int Student::numAssignments() const { return numAssigns; } //------------------------------------------------------------------------- void Student::addAssignment( int score ) { ++numAssigns; totalPoints += score; } //------------------------------------------------------------------------- int Student::assignmentAverage() const { return totalPoints / numAssigns; } //------------------------------------------------------------------------- string Student::toString() const { std::ostringstream out; out << name() << " (" << assignmentAverage() << ")"; return out.str(); } //------------------------------------------------------------------------- bool Student::operator==( const Student& rhs ) const { return studentName == rhs.studentName && numAssigns == rhs.numAssigns && totalPoints == rhs.totalPoints; } //------------------------------------------------------------------------- bool Student::operator!=( const Student& rhs ) const { return !( *this == rhs ); }