#K92992. Task Management System
Task Management System
Task Management System
You are required to implement a task management system for a team project. In this system, each team member (identified by a numeric ID) can be assigned multiple tasks. Every task has an associated status which can be one of the following: \(incomplete\), \(in\ progress\) (represented as in_progress
in the input) or \(complete\).
The system should support the following operations:
assign user task
: Assign a new task to a user with an initial status of \(incomplete\).update user task status
: Update the status of an existing task for a user.count user status
: Count and output the number of tasks for a user that have the specified status.list user
: List all tasks assigned to a user in the order they were assigned. Each task should be output as atask:status
pair, and pairs should be separated by a comma and a space. If a user has no tasks, output an empty line.
For example, if we execute the operations:
assign 1 task1 assign 1 task2 assign 2 task3 assign 2 task4 count 1 incomplete update 1 task1 in_progress assign 1 task6 update 2 task4 complete list 1
Then the expected outputs for the count
and list
commands would be:
2 2 task1:in_progress, task2:incomplete, task6:incomplete
inputFormat
The first line contains an integer (Q) representing the number of commands. Each of the following (Q) lines contains one command. Commands are given in one of the following formats:
assign user task
(\rightarrow) Assign a new task to the user with an initial status of "incomplete".update user task status
(\rightarrow) Update the status of the given task for the user. The status is one of "incomplete", "in_progress", or "complete". Note that although the description mentions "in progress", the input usesin_progress
.count user status
(\rightarrow) Output the number of tasks for the user that have the specified status.list user
(\rightarrow) List all tasks assigned to the user in the order they were assigned. Output each task as a "task:status" pair, separated by a comma and a space. If no tasks exist for the user, output an empty line.
All inputs are read from standard input (stdin).
outputFormat
For each command that requests an output (count
and list
commands), print the result on a new line to standard output (stdout).## sample
10
assign 1 task1
assign 1 task2
assign 2 task3
assign 2 task4
count 1 incomplete
count 2 incomplete
update 1 task1 in_progress
assign 1 task6
update 2 task4 complete
list 1
2
2
task1:in_progress, task2:incomplete, task6:incomplete
</p>