#K77442. To-Do List Manager

    ID: 34865 Type: Default 1000ms 256MiB

To-Do List Manager

To-Do List Manager

You are required to implement a to-do list manager which supports the following commands:

  • ADD "title" "description" [due_date]: Add a new task with the given title and description. The due date is optional and, if provided, will be in the format \(YYYY\text{-}MM\text{-}DD\). If no due date is provided, consider it as 'No due date'.
  • COMPLETE "title": Mark the task with the given title as completed.
  • LIST [option]: List tasks based on the option. The option can be:
    • all (default): List all tasks.
    • completed: List only the tasks that have been completed.
    • uncompleted: List only the tasks that have not been completed.
  • EXIT: Terminate the input.

For each task printed by the LIST command, the output format should be:

Title: <title>, Description: <description>, Due Date: <due date or 'No due date'>, Status: <Completed/Uncompleted>

Your program should process commands from standard input and output results to standard output accordingly.

inputFormat

The input consists of multiple lines. Each line represents a command in one of the following formats:

  • ADD "title" "description" [due_date]
  • COMPLETE "title"
  • LIST [option]
  • EXIT

The input is terminated by the command EXIT.

outputFormat

For every LIST command, output the task details in the following format (each task on a new line):

Title: <title>, Description: <description>, Due Date: <due date / 'No due date'>, Status: <Completed/Uncompleted>

If multiple LIST commands are given, the output should be printed in the same order as the commands appear.

## sample
ADD "Buy groceries" "Buy milk, eggs, and bread" 2023-11-03
ADD "Read book" "Finish reading the current novel"
ADD "Prepare presentation" "Slides for Monday's meeting"
COMPLETE "Read book"
LIST all
EXIT
Title: Buy groceries, Description: Buy milk, eggs, and bread, Due Date: 2023-11-03, Status: Uncompleted

Title: Read book, Description: Finish reading the current novel, Due Date: No due date, Status: Completed Title: Prepare presentation, Description: Slides for Monday's meeting, Due Date: No due date, Status: Uncompleted

</p>