-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTask.cpp
More file actions
executable file
·49 lines (43 loc) · 1.28 KB
/
Copy pathTask.cpp
File metadata and controls
executable file
·49 lines (43 loc) · 1.28 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
#include "Task.h"
/* PRINT FUNCTIONS that display any specialized task information */
void Task::print(bool detailed) const {
string type = getType();
if (type != "") {
type = " [" + type + "] ";
}
else {
type = " ";
}
cout << "(" << deadline << " day" << (deadline != 1 ? "s" : "") << " from now)"
<< type << description << "\n";
}
void ShoppingTask::print(bool detailed) const {
Task::print(detailed);
if (detailed) {
cout << "\tITEMS TO PURCHASE:\n";
for (unsigned int i = 0, n = items.size(); i < n; i++) {
cout << "\t" << items[i] << "\n";
}
}
}
void EventTask::print(bool detailed) const {
Task::print(detailed);
if (detailed) {
cout << "\tWHERE: " << location << "\n"
<< "\tWHEN: " << time << "\n";
}
}
void HomeworkTask::print(bool detailed) const {
Task::print(detailed);
if (detailed) {
cout << "\tSUBJECT: " << subject << "\n";
}
}
// Outputs task’s data to a file.
// Each individual component of a task’s data is separated by a pipe character
void ShoppingTask::dump(ostream& out) const {
out << "S|" << deadline << "|" << description;
for (unsigned int i = 0, n = items.size(); i < n; i++) {
out << "|" << items[i];
}
}