previous | start | next

1.1.2 Example 2: Student Record

A student record has a name, id, and list of test scores.

class StudentRecord
{
private:
  string student_name; // Note string is a (standard c++) class
  string student_id;   
  Array<int> scores;
public:
  StudentRecord(string nm, string id)
        : student_name(nm), student_id(id) {}
  int getNumScores() const;
  double getAvg() const;
  int getMaxScore() const;
  int getMinScore() const;
  Array getScores() const;

  void addTestScore(int value);
};      


previous | start | next