1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
class Student {
//Student class declaration
public:
//default constructor to set a studen data to: "NONE", "NONE",-1,'D'
Student(string FirstName="None", string LastName="None", int Id=-1, char Type = 'D');
//set and get students first name of string type
void setFirstName(const string&);
string getFirstName() const;
//set and get students last name of string type
void setLastName(const string&);
string getLastName() const;
//set and get students id number of int type
void setId(int);
int getId() const;
//set and get students type 'D' char for domestic, 'I' char for international
void setType(char);
char getType() const;
private:
string mFirstName; // the first (given) name of the student
string mLastName; // the last(family) name of the student
int mId; // the student ID value
char mType; // student type -- D=domestic or I = // International)
};
class Course{
//--Course class declaration
public:
//default constructor to set a course data to: 0,"NOT-SET", 0, 0
Course(size_t Id=0, string Title= "NOT-SET", size_t Credits=0, size_t NrStds=0);
//set and get for course id number of size_t type
void setId(size_t);
size_t getId() const;
//set and get the number (size_t type) of students in this course
void setNrStds(size_t);
size_t getNrStds() const;
//set and get of course name (of string type)
void setTitle(const string&);
string getTitle() const;
//set and get of credits (of size_t type) for a course
void setCredits(size_t);
size_t getCredits() const;
//takes an index and student id number
//and sets students enrolled in the course into the mStudIds array
void addStudent(size_t, size_t);
//takes a student id (int) returns true if the student
//is enrolled in the course, false otherwise
bool hasStudent(int) const;
//returns true if the course has no students
//enrolled and false otherwise
bool hasNoStudent() const;
//takes an array of students and its size and
//returns true if this course contains at least one student that //is not in the students array
bool hasNonExistentStud(Student[], size_t) const;
private:
size_t mId; //course id, like 158753
string mTitle; //course name, like Automata-theory
size_t mCredits; //credits for this course, like 15
size_t mNrStds; //total number of students enrolled in this course
int mStudIds[MAX_STUDENTS];//array of ids of students enrolled in this course
};
|