-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTask.h
More file actions
59 lines (50 loc) · 1.97 KB
/
Task.h
File metadata and controls
59 lines (50 loc) · 1.97 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
#ifndef TASK_H
#define TASK_H
#include <string>
#include <iostream>
#include <iomanip>
using namespace std;
struct Task
{
int id;
string title;
string description;
string assigningDate;
string endingDate;
string employeeName;
int priority; // 1-10 (1 = least important, 10 = most important)
bool isDone;
// Default constructor
Task() : id(0), priority(0), isDone(false) {}
// Parameterized constructor
Task(int id, string title, string description, string assignDate,
string endDate, string empName, int priority)
: id(id), title(title), description(description),
assigningDate(assignDate), endingDate(endDate),
employeeName(empName), priority(priority), isDone(false) {}
// Display task details
void display() const
{
cout << "\n+------------------------------------------+" << endl;
cout << "| Task ID: " << left << setw(32) << id << "|" << endl;
cout << "+------------------------------------------+" << endl;
cout << "| Title: " << left << setw(34) << title << "|" << endl;
cout << "| Description: " << left << setw(28) << description << "|" << endl;
cout << "| Assigned To: " << left << setw(28) << employeeName << "|" << endl;
cout << "| Assigning Date: " << left << setw(25) << assigningDate << "|" << endl;
cout << "| Due Date: " << left << setw(31) << endingDate << "|" << endl;
cout << "| Priority: " << left << setw(31) << priority << "|" << endl;
cout << "| Status: " << left << setw(33) << (isDone ? "COMPLETED" : "PENDING") << "|" << endl;
cout << "+------------------------------------------+" << endl;
}
// Comparison operator for priority (for max-heap: higher priority = higher value)
bool operator<(const Task &other) const
{
return priority < other.priority;
}
bool operator>(const Task &other) const
{
return priority > other.priority;
}
};
#endif // TASK_H