-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCourse.cpp
53 lines (51 loc) · 1.54 KB
/
Course.cpp
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
#include <bits/stdc++.h>
#include "Course.h"
#include "Professor.h"
using namespace std;
Course::Course(string name, int courseCode, int type){
this->name = name;
this->courseCode = courseCode;
this->type = type;
}
int Course::getCourseCode(){
return courseCode;
}
int Course::getType(){
return type;
}
string Course::getName(){
return name;
}
vector<Professor*> Course::getProfessors(){
return professors;
}
void Course::addProfessor(Professor professor){
professors.push_back(&professor);
}
void Course::addProfessor(Professor* professor){
professors.push_back(professor);
}
void Course::setProfessors(vector<Professor*> professors){
this->professors = professors;
}
vector<Professor*> Course::getAllottedTo(){
return allottedTo;
}
void Course::setAllottedTo(vector<Professor*> allottedTo){
if (allottedTo.size() > 2){
throw invalid_argument("ERROR: Cannot allot more than 2 professors to a course.\nPlease allot only 2 professors to this course.");
}
this->allottedTo = allottedTo;
}
void Course::allotTo(Professor* professor){
if(allottedTo.size() >= 2){
throw invalid_argument("ERROR: Cannot allot more than 2 professors to a course.\nPlease allot only 2 professors to this course.");
}
allottedTo.push_back(professor);
}
void Course::allotTo(Professor professor){
if(allottedTo.size() >= 2){
throw invalid_argument("ERROR: Cannot allot more than 2 professors to a course.\nPlease allot only 2 professors to this course.");
}
allottedTo.push_back(&professor);
}