[Lab Evaluation] STL - Task Manager


Submit solution

Points: 10 (partial)
Time limit: 0.5s
Memory limit: 12M

Author:
Problem type
Allowed languages
C++

Task Manager using STL

Implement a Task Manager using STL in C++. The program should manage the tasks and their due dates. The main functionalities of the Task Manager include adding tasks, marking tasks as completed, and displaying the task list & completed task list.

Below is the provided code as a starting point:

#include <iostream>

using namespace std;

class TaskManager {
private:
    struct Task {
        string name;
        string dueDate;
    };

    vector<Task> tasks;
    vector<string> completedTasks;
    map<string, string> taskDueDates;

public:
    void addTask(const string& name, const string& dueDate) {
        // Your code here
    }

    void markAsCompleted(int index) {
        // Your code here
    }

    void displayTasks() {
        // Your code here
    }
};

int main() {
    TaskManager taskManager;
    int choice;

    do {
        // Your code here

    } while (choice != 4);

    return 0;
}

Testcase

Input 1
1
SecretSanta
07-Jan-2024
1
Lab3
21-Dec-2023
1
CyberConnect
23-Dec-2023
3
4
Output 1
Task added successfully!
Task added successfully!
Task added successfully!
Tasks to do:
0. SecretSanta (Due: 07-Jan-2024)
1. Lab3 (Due: 21-Dec-2023)
2. CyberConnect (Due: 23-Dec-2023)

Completed tasks:
Exiting Task Manager. Goodbye!
Input 2
1
SecretSanta
07-Jan-2024
1
Lab3
21-Dec-2023
1
CyberConnect
23-Dec-2023
3
2
1
3
4
Ouput 2
Task added successfully!
Task added successfully!
Task added successfully!
Tasks to do:
0. SecretSanta (Due: 07-Jan-2024)
1. Lab3 (Due: 21-Dec-2023)
2. CyberConnect (Due: 23-Dec-2023)

Completed tasks:
Task marked as completed!
Tasks to do:
0. SecretSanta (Due: 07-Jan-2024)
1. CyberConnect (Due: 23-Dec-2023)

Completed tasks:
Lab3
Exiting Task Manager. Goodbye!

Comments

There are no comments at the moment.