-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstance.cpp
More file actions
67 lines (57 loc) · 1.41 KB
/
Copy pathinstance.cpp
File metadata and controls
67 lines (57 loc) · 1.41 KB
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
#include "instance.hh"
#include "course.hh"
Instance::Instance(Course* course, std::string instance_name, const Date date):
course_(course), instance_name_(instance_name), instance_date_(date)
{
}
void Instance::print() {
std::cout << instance_name_ << std::endl;
std::cout << INDENT << "Starting date: ";
instance_date_.print();
std::cout << std::endl;
std::cout << INDENT << "Amount of students: " << students_.size() << std::endl;
}
void Instance::print_students() {
if (students_.size() != 0) {
for (auto student: students_) {
std::cout << INDENT;
student->print();
}
}
}
void Instance::add_student_to_instance(Account* account, Date today)
{
if (instance_date_ == today) {
students_.push_back(account);
account->add_to_current(this);
std::cout << SIGNED_UP << std::endl;
return;
}
else {
std::cout << LATE << std::endl;
}
}
bool Instance::is_named(const std::string& name) {
if (name == instance_name_){
return true;
}
else {
return false;
}
}
bool Instance::find_student(Account* account) {
if (std::find(students_.begin(), students_.end(), account) == students_.end()) {
return true;
}
else {
return false;
}
}
std::string Instance::get_name()
{
return instance_name_;
}
Course *Instance::get_course()
{
return course_;
}