From 6f0a7b611f1813f6fe896db81393dca0be52b885 Mon Sep 17 00:00:00 2001 From: Wang Jingwei Date: Sun, 13 Feb 2022 23:39:49 +0800 Subject: [PATCH 01/23] Add a list and display the list --- src/main/java/Duke.java | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/main/java/Duke.java b/src/main/java/Duke.java index 5d313334c..aac0a7baa 100644 --- a/src/main/java/Duke.java +++ b/src/main/java/Duke.java @@ -1,3 +1,5 @@ +import java.util.Scanner; +import java.util.ArrayList; public class Duke { public static void main(String[] args) { String logo = " ____ _ \n" @@ -5,6 +7,26 @@ public static void main(String[] args) { + "| | | | | | | |/ / _ \\\n" + "| |_| | |_| | < __/\n" + "|____/ \\__,_|_|\\_\\___|\n"; + ArrayList todolist = new ArrayList(); + String task; System.out.println("Hello from\n" + logo); + System.out.println("Hello! I'm Duke\nWhat can I do for you?\n"); + Scanner in = new Scanner(System.in); + task=in.nextLine(); + while(true){ + if(task.equalsIgnoreCase("bye")) + break; + if(task.equalsIgnoreCase("list")){ + for (int i = 0; i < todolist.size(); i++) + System.out.println((i+1)+"."+todolist.get(i)); + task=in.nextLine(); + continue;} + else{ + System.out.println("added:"+task); + todolist.add(task); + task=in.nextLine(); + continue;} + } + System.out.println("Bye. Hope to see you again soon!"); } } From 557cb7f73410a6a1bb39349020c8f51f5f69b101 Mon Sep 17 00:00:00 2001 From: Wang Jingwei Date: Tue, 15 Feb 2022 11:09:46 +0800 Subject: [PATCH 02/23] Add a task class with description and isDone --- src/main/java/Task.java | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/main/java/Task.java diff --git a/src/main/java/Task.java b/src/main/java/Task.java new file mode 100644 index 000000000..b2118bd78 --- /dev/null +++ b/src/main/java/Task.java @@ -0,0 +1,29 @@ +public class Task { + protected String description; + protected boolean isDone; + + public Task(String description) { + this.description = description; + this.isDone = false; + } + + public String getStatusIcon() { + return (isDone ? "X" : " "); // mark done task with X + } + + public String getDescription(){ + return description; + } + + public void setDescription(String description1){ + description=description1; + } + + public void markAsDone(){ + isDone=true; + } + + public void markAsUndone(){ + isDone=false; + } +} From e6b45a1c42a9ffa9fd8a4075bd0a06ad8c23f1b8 Mon Sep 17 00:00:00 2001 From: Wang Jingwei Date: Tue, 15 Feb 2022 11:58:49 +0800 Subject: [PATCH 03/23] Add a method to return task string. --- src/main/java/Task.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/Task.java b/src/main/java/Task.java index b2118bd78..2e3dacd24 100644 --- a/src/main/java/Task.java +++ b/src/main/java/Task.java @@ -26,4 +26,7 @@ public void markAsDone(){ public void markAsUndone(){ isDone=false; } + public String taskString(){ + return "["+getStatusIcon()+"] "+description; + } } From c4c9b4c43882452d33aa7d9ef9f3c594d8acf992 Mon Sep 17 00:00:00 2001 From: Wang Jingwei Date: Tue, 15 Feb 2022 11:59:32 +0800 Subject: [PATCH 04/23] Add the ability to mark tasks as done and change the status back to not done. --- src/main/java/Duke.java | 43 +++++++++++++++++++++++++++++++++++------ 1 file changed, 37 insertions(+), 6 deletions(-) diff --git a/src/main/java/Duke.java b/src/main/java/Duke.java index aac0a7baa..9594dcc5d 100644 --- a/src/main/java/Duke.java +++ b/src/main/java/Duke.java @@ -7,26 +7,57 @@ public static void main(String[] args) { + "| | | | | | | |/ / _ \\\n" + "| |_| | |_| | < __/\n" + "|____/ \\__,_|_|\\_\\___|\n"; - ArrayList todolist = new ArrayList(); + ArrayList todolist = new ArrayList(); String task; System.out.println("Hello from\n" + logo); - System.out.println("Hello! I'm Duke\nWhat can I do for you?\n"); + System.out.println("Hello! I'm Duke\nWhat can I do for you?"); Scanner in = new Scanner(System.in); task=in.nextLine(); while(true){ if(task.equalsIgnoreCase("bye")) break; if(task.equalsIgnoreCase("list")){ + System.out.println("Here are the tasks in your list:"); for (int i = 0; i < todolist.size(); i++) - System.out.println((i+1)+"."+todolist.get(i)); + System.out.println((i+1)+". "+todolist.get(i).taskString()); task=in.nextLine(); continue;} else{ - System.out.println("added:"+task); - todolist.add(task); + String[] words = task.split(" "); + if (words[0].equalsIgnoreCase("mark")){ + try{ + int index = Integer.parseInt(words[1]); + if(index>todolist.size()||index<=0) System.out.println("No task found."); + else{ + todolist.get(index-1).markAsDone(); + System.out.println("Nice! I've marked this task as done:"); + System.out.println((index)+". "+todolist.get(index-1).taskString()); + } + } + catch (NumberFormatException ex){ + ex.printStackTrace(); + } + } + else if (words[0].equalsIgnoreCase("unmark")){ + try{ + int index = Integer.parseInt(words[1]); + if(index>todolist.size()||index<=0) System.out.println("No task found."); + else { + todolist.get(index-1).markAsUndone(); + System.out.println("OK, I've marked this task as not done yet:"); + System.out.println((index)+". "+todolist.get(index-1).taskString()); + } + } + catch (NumberFormatException ex){ + ex.printStackTrace(); + } + } + else{ + System.out.println("added:"+task); + todolist.add(new Task(task)); } task=in.nextLine(); continue;} } - System.out.println("Bye. Hope to see you again soon!"); + System.out.println("Bye.Have a nice day!"); } } From f44a3e6290f64f3c84fdbf818ab144e90e52ff2f Mon Sep 17 00:00:00 2001 From: Wang Jingwei Date: Tue, 15 Feb 2022 15:08:25 +0800 Subject: [PATCH 05/23] Add a deadline class. --- src/main/java/Deadline.java | 22 ++++++++++++++ src/main/java/Duke.java | 59 ++++++++++++++++++++++++++----------- src/main/java/Event.java | 23 +++++++++++++++ src/main/java/Task.java | 2 +- src/main/java/ToDo.java | 11 +++++++ 5 files changed, 99 insertions(+), 18 deletions(-) create mode 100644 src/main/java/Deadline.java create mode 100644 src/main/java/Event.java create mode 100644 src/main/java/ToDo.java diff --git a/src/main/java/Deadline.java b/src/main/java/Deadline.java new file mode 100644 index 000000000..885bade66 --- /dev/null +++ b/src/main/java/Deadline.java @@ -0,0 +1,22 @@ +public class Deadline extends Task { + + protected String by; + + public Deadline(String description, String by) { + super(description); + this.by = by; + } + + public void setBy(String by){ + this.by=by; + } + + public String getBy(){ + return by; + } + + @Override + public String toString() { + return "[D]" + super.toString() + " (by:" + by + ")"; + } +} diff --git a/src/main/java/Duke.java b/src/main/java/Duke.java index 9594dcc5d..f5636a052 100644 --- a/src/main/java/Duke.java +++ b/src/main/java/Duke.java @@ -16,47 +16,72 @@ public static void main(String[] args) { while(true){ if(task.equalsIgnoreCase("bye")) break; - if(task.equalsIgnoreCase("list")){ - System.out.println("Here are the tasks in your list:"); - for (int i = 0; i < todolist.size(); i++) - System.out.println((i+1)+". "+todolist.get(i).taskString()); - task=in.nextLine(); - continue;} - else{ - String[] words = task.split(" "); - if (words[0].equalsIgnoreCase("mark")){ + String[] words = task.split(" ",2); + switch (words[0].toLowerCase()){ + case "list":{ + System.out.println("Here are the tasks in your list:"); + for (int i = 0; i < todolist.size(); i++) + System.out.println((i+1)+". "+todolist.get(i).toString()); + break; + } + case "mark":{ try{ int index = Integer.parseInt(words[1]); if(index>todolist.size()||index<=0) System.out.println("No task found."); else{ todolist.get(index-1).markAsDone(); System.out.println("Nice! I've marked this task as done:"); - System.out.println((index)+". "+todolist.get(index-1).taskString()); + System.out.println((index)+". "+todolist.get(index-1).toString()); } } catch (NumberFormatException ex){ ex.printStackTrace(); } + break; } - else if (words[0].equalsIgnoreCase("unmark")){ + case "unmark":{ try{ int index = Integer.parseInt(words[1]); if(index>todolist.size()||index<=0) System.out.println("No task found."); else { todolist.get(index-1).markAsUndone(); System.out.println("OK, I've marked this task as not done yet:"); - System.out.println((index)+". "+todolist.get(index-1).taskString()); + System.out.println((index)+". "+todolist.get(index-1).toString()); } } catch (NumberFormatException ex){ ex.printStackTrace(); } + break; + } + case "todo": { + todolist.add(new ToDo(words[1])); + System.out.println("Got it. I've added this task:"); + System.out.println(" " + todolist.get(todolist.size() - 1).toString()); + System.out.println("Now you have " + todolist.size() + " tasks in the list."); + break; + } + case "deadline": { + String[] words1 = words[1].split("/by", 2); + todolist.add(new Deadline(words1[0], words1[1])); + System.out.println("Got it. I've added this task:"); + System.out.println(" " + todolist.get(todolist.size() - 1).toString()); + System.out.println("Now you have " + todolist.size() + " tasks in the list."); + break; + } + case "event": { + String[] words1 = words[1].split("/at", 2); + todolist.add(new Event(words1[0], words1[1])); + System.out.println("Got it. I've added this task:"); + System.out.println(" " + todolist.get(todolist.size() - 1).toString()); + System.out.println("Now you have " + todolist.size() + " tasks in the list."); + break; } - else{ - System.out.println("added:"+task); - todolist.add(new Task(task)); } - task=in.nextLine(); - continue;} + default: + System.out.println("Sorry,I don't understand what you are saying." + + " Could you please type again with given keywords?"); + } + task=in.nextLine(); } System.out.println("Bye.Have a nice day!"); } diff --git a/src/main/java/Event.java b/src/main/java/Event.java new file mode 100644 index 000000000..2b033012a --- /dev/null +++ b/src/main/java/Event.java @@ -0,0 +1,23 @@ +public class Event extends Task { + + protected String at; + + public Event(String description, String at) { + super(description); + this.at = at; + } + + public void setAt(String at){ + this.at=at; + } + + public String getAt(){ + return at; + } + + @Override + public String toString() { + return "[E]" + super.toString() + " (at:" + at + ")"; + } +} + diff --git a/src/main/java/Task.java b/src/main/java/Task.java index 2e3dacd24..c481fc249 100644 --- a/src/main/java/Task.java +++ b/src/main/java/Task.java @@ -26,7 +26,7 @@ public void markAsDone(){ public void markAsUndone(){ isDone=false; } - public String taskString(){ + public String toString(){ return "["+getStatusIcon()+"] "+description; } } diff --git a/src/main/java/ToDo.java b/src/main/java/ToDo.java new file mode 100644 index 000000000..25be5ee3c --- /dev/null +++ b/src/main/java/ToDo.java @@ -0,0 +1,11 @@ +public class ToDo extends Task { + + public ToDo(String description) { + super(description); + } + + @Override + public String toString() { + return "[T]" + super.toString(); + } +} \ No newline at end of file From 748b623dbe7063ec5e27dfe9a56eee475a4a80ff Mon Sep 17 00:00:00 2001 From: Wang Jingwei Date: Tue, 15 Feb 2022 15:09:37 +0800 Subject: [PATCH 06/23] Revert "Add a deadline class." This reverts commit f44a3e6290f64f3c84fdbf818ab144e90e52ff2f. --- src/main/java/Deadline.java | 22 -------------- src/main/java/Duke.java | 59 +++++++++++-------------------------- src/main/java/Event.java | 23 --------------- src/main/java/Task.java | 2 +- src/main/java/ToDo.java | 11 ------- 5 files changed, 18 insertions(+), 99 deletions(-) delete mode 100644 src/main/java/Deadline.java delete mode 100644 src/main/java/Event.java delete mode 100644 src/main/java/ToDo.java diff --git a/src/main/java/Deadline.java b/src/main/java/Deadline.java deleted file mode 100644 index 885bade66..000000000 --- a/src/main/java/Deadline.java +++ /dev/null @@ -1,22 +0,0 @@ -public class Deadline extends Task { - - protected String by; - - public Deadline(String description, String by) { - super(description); - this.by = by; - } - - public void setBy(String by){ - this.by=by; - } - - public String getBy(){ - return by; - } - - @Override - public String toString() { - return "[D]" + super.toString() + " (by:" + by + ")"; - } -} diff --git a/src/main/java/Duke.java b/src/main/java/Duke.java index f5636a052..9594dcc5d 100644 --- a/src/main/java/Duke.java +++ b/src/main/java/Duke.java @@ -16,72 +16,47 @@ public static void main(String[] args) { while(true){ if(task.equalsIgnoreCase("bye")) break; - String[] words = task.split(" ",2); - switch (words[0].toLowerCase()){ - case "list":{ - System.out.println("Here are the tasks in your list:"); - for (int i = 0; i < todolist.size(); i++) - System.out.println((i+1)+". "+todolist.get(i).toString()); - break; - } - case "mark":{ + if(task.equalsIgnoreCase("list")){ + System.out.println("Here are the tasks in your list:"); + for (int i = 0; i < todolist.size(); i++) + System.out.println((i+1)+". "+todolist.get(i).taskString()); + task=in.nextLine(); + continue;} + else{ + String[] words = task.split(" "); + if (words[0].equalsIgnoreCase("mark")){ try{ int index = Integer.parseInt(words[1]); if(index>todolist.size()||index<=0) System.out.println("No task found."); else{ todolist.get(index-1).markAsDone(); System.out.println("Nice! I've marked this task as done:"); - System.out.println((index)+". "+todolist.get(index-1).toString()); + System.out.println((index)+". "+todolist.get(index-1).taskString()); } } catch (NumberFormatException ex){ ex.printStackTrace(); } - break; } - case "unmark":{ + else if (words[0].equalsIgnoreCase("unmark")){ try{ int index = Integer.parseInt(words[1]); if(index>todolist.size()||index<=0) System.out.println("No task found."); else { todolist.get(index-1).markAsUndone(); System.out.println("OK, I've marked this task as not done yet:"); - System.out.println((index)+". "+todolist.get(index-1).toString()); + System.out.println((index)+". "+todolist.get(index-1).taskString()); } } catch (NumberFormatException ex){ ex.printStackTrace(); } - break; - } - case "todo": { - todolist.add(new ToDo(words[1])); - System.out.println("Got it. I've added this task:"); - System.out.println(" " + todolist.get(todolist.size() - 1).toString()); - System.out.println("Now you have " + todolist.size() + " tasks in the list."); - break; - } - case "deadline": { - String[] words1 = words[1].split("/by", 2); - todolist.add(new Deadline(words1[0], words1[1])); - System.out.println("Got it. I've added this task:"); - System.out.println(" " + todolist.get(todolist.size() - 1).toString()); - System.out.println("Now you have " + todolist.size() + " tasks in the list."); - break; - } - case "event": { - String[] words1 = words[1].split("/at", 2); - todolist.add(new Event(words1[0], words1[1])); - System.out.println("Got it. I've added this task:"); - System.out.println(" " + todolist.get(todolist.size() - 1).toString()); - System.out.println("Now you have " + todolist.size() + " tasks in the list."); - break; } - default: - System.out.println("Sorry,I don't understand what you are saying." + - " Could you please type again with given keywords?"); - } - task=in.nextLine(); + else{ + System.out.println("added:"+task); + todolist.add(new Task(task)); } + task=in.nextLine(); + continue;} } System.out.println("Bye.Have a nice day!"); } diff --git a/src/main/java/Event.java b/src/main/java/Event.java deleted file mode 100644 index 2b033012a..000000000 --- a/src/main/java/Event.java +++ /dev/null @@ -1,23 +0,0 @@ -public class Event extends Task { - - protected String at; - - public Event(String description, String at) { - super(description); - this.at = at; - } - - public void setAt(String at){ - this.at=at; - } - - public String getAt(){ - return at; - } - - @Override - public String toString() { - return "[E]" + super.toString() + " (at:" + at + ")"; - } -} - diff --git a/src/main/java/Task.java b/src/main/java/Task.java index c481fc249..2e3dacd24 100644 --- a/src/main/java/Task.java +++ b/src/main/java/Task.java @@ -26,7 +26,7 @@ public void markAsDone(){ public void markAsUndone(){ isDone=false; } - public String toString(){ + public String taskString(){ return "["+getStatusIcon()+"] "+description; } } diff --git a/src/main/java/ToDo.java b/src/main/java/ToDo.java deleted file mode 100644 index 25be5ee3c..000000000 --- a/src/main/java/ToDo.java +++ /dev/null @@ -1,11 +0,0 @@ -public class ToDo extends Task { - - public ToDo(String description) { - super(description); - } - - @Override - public String toString() { - return "[T]" + super.toString(); - } -} \ No newline at end of file From db0a7b170144e9ea285062263972c81d1f6194ae Mon Sep 17 00:00:00 2001 From: Wang Jingwei Date: Tue, 15 Feb 2022 15:11:02 +0800 Subject: [PATCH 07/23] Add three types of tasks-Deadline, Event and ToDo. This reverts commit 748b623dbe7063ec5e27dfe9a56eee475a4a80ff. --- src/main/java/Deadline.java | 22 ++++++++++++++ src/main/java/Duke.java | 59 ++++++++++++++++++++++++++----------- src/main/java/Event.java | 23 +++++++++++++++ src/main/java/Task.java | 2 +- src/main/java/ToDo.java | 11 +++++++ 5 files changed, 99 insertions(+), 18 deletions(-) create mode 100644 src/main/java/Deadline.java create mode 100644 src/main/java/Event.java create mode 100644 src/main/java/ToDo.java diff --git a/src/main/java/Deadline.java b/src/main/java/Deadline.java new file mode 100644 index 000000000..885bade66 --- /dev/null +++ b/src/main/java/Deadline.java @@ -0,0 +1,22 @@ +public class Deadline extends Task { + + protected String by; + + public Deadline(String description, String by) { + super(description); + this.by = by; + } + + public void setBy(String by){ + this.by=by; + } + + public String getBy(){ + return by; + } + + @Override + public String toString() { + return "[D]" + super.toString() + " (by:" + by + ")"; + } +} diff --git a/src/main/java/Duke.java b/src/main/java/Duke.java index 9594dcc5d..f5636a052 100644 --- a/src/main/java/Duke.java +++ b/src/main/java/Duke.java @@ -16,47 +16,72 @@ public static void main(String[] args) { while(true){ if(task.equalsIgnoreCase("bye")) break; - if(task.equalsIgnoreCase("list")){ - System.out.println("Here are the tasks in your list:"); - for (int i = 0; i < todolist.size(); i++) - System.out.println((i+1)+". "+todolist.get(i).taskString()); - task=in.nextLine(); - continue;} - else{ - String[] words = task.split(" "); - if (words[0].equalsIgnoreCase("mark")){ + String[] words = task.split(" ",2); + switch (words[0].toLowerCase()){ + case "list":{ + System.out.println("Here are the tasks in your list:"); + for (int i = 0; i < todolist.size(); i++) + System.out.println((i+1)+". "+todolist.get(i).toString()); + break; + } + case "mark":{ try{ int index = Integer.parseInt(words[1]); if(index>todolist.size()||index<=0) System.out.println("No task found."); else{ todolist.get(index-1).markAsDone(); System.out.println("Nice! I've marked this task as done:"); - System.out.println((index)+". "+todolist.get(index-1).taskString()); + System.out.println((index)+". "+todolist.get(index-1).toString()); } } catch (NumberFormatException ex){ ex.printStackTrace(); } + break; } - else if (words[0].equalsIgnoreCase("unmark")){ + case "unmark":{ try{ int index = Integer.parseInt(words[1]); if(index>todolist.size()||index<=0) System.out.println("No task found."); else { todolist.get(index-1).markAsUndone(); System.out.println("OK, I've marked this task as not done yet:"); - System.out.println((index)+". "+todolist.get(index-1).taskString()); + System.out.println((index)+". "+todolist.get(index-1).toString()); } } catch (NumberFormatException ex){ ex.printStackTrace(); } + break; + } + case "todo": { + todolist.add(new ToDo(words[1])); + System.out.println("Got it. I've added this task:"); + System.out.println(" " + todolist.get(todolist.size() - 1).toString()); + System.out.println("Now you have " + todolist.size() + " tasks in the list."); + break; + } + case "deadline": { + String[] words1 = words[1].split("/by", 2); + todolist.add(new Deadline(words1[0], words1[1])); + System.out.println("Got it. I've added this task:"); + System.out.println(" " + todolist.get(todolist.size() - 1).toString()); + System.out.println("Now you have " + todolist.size() + " tasks in the list."); + break; + } + case "event": { + String[] words1 = words[1].split("/at", 2); + todolist.add(new Event(words1[0], words1[1])); + System.out.println("Got it. I've added this task:"); + System.out.println(" " + todolist.get(todolist.size() - 1).toString()); + System.out.println("Now you have " + todolist.size() + " tasks in the list."); + break; } - else{ - System.out.println("added:"+task); - todolist.add(new Task(task)); } - task=in.nextLine(); - continue;} + default: + System.out.println("Sorry,I don't understand what you are saying." + + " Could you please type again with given keywords?"); + } + task=in.nextLine(); } System.out.println("Bye.Have a nice day!"); } diff --git a/src/main/java/Event.java b/src/main/java/Event.java new file mode 100644 index 000000000..2b033012a --- /dev/null +++ b/src/main/java/Event.java @@ -0,0 +1,23 @@ +public class Event extends Task { + + protected String at; + + public Event(String description, String at) { + super(description); + this.at = at; + } + + public void setAt(String at){ + this.at=at; + } + + public String getAt(){ + return at; + } + + @Override + public String toString() { + return "[E]" + super.toString() + " (at:" + at + ")"; + } +} + diff --git a/src/main/java/Task.java b/src/main/java/Task.java index 2e3dacd24..c481fc249 100644 --- a/src/main/java/Task.java +++ b/src/main/java/Task.java @@ -26,7 +26,7 @@ public void markAsDone(){ public void markAsUndone(){ isDone=false; } - public String taskString(){ + public String toString(){ return "["+getStatusIcon()+"] "+description; } } diff --git a/src/main/java/ToDo.java b/src/main/java/ToDo.java new file mode 100644 index 000000000..25be5ee3c --- /dev/null +++ b/src/main/java/ToDo.java @@ -0,0 +1,11 @@ +public class ToDo extends Task { + + public ToDo(String description) { + super(description); + } + + @Override + public String toString() { + return "[T]" + super.toString(); + } +} \ No newline at end of file From 6bd1236fb1a6d1fc414c4a4813be61499bd565a1 Mon Sep 17 00:00:00 2001 From: Wang Jingwei Date: Tue, 15 Feb 2022 17:28:15 +0800 Subject: [PATCH 08/23] Add quite a number of error handling. --- src/main/java/Duke.java | 103 ++++++++++++++++++++++++++-------------- 1 file changed, 67 insertions(+), 36 deletions(-) diff --git a/src/main/java/Duke.java b/src/main/java/Duke.java index f5636a052..96f1b7e84 100644 --- a/src/main/java/Duke.java +++ b/src/main/java/Duke.java @@ -25,61 +25,92 @@ public static void main(String[] args) { break; } case "mark":{ - try{ - int index = Integer.parseInt(words[1]); - if(index>todolist.size()||index<=0) System.out.println("No task found."); - else{ - todolist.get(index-1).markAsDone(); - System.out.println("Nice! I've marked this task as done:"); - System.out.println((index)+". "+todolist.get(index-1).toString()); + if (words.length==1) + System.out.println("☹ OOPS!!! Please tell me the task you want to mark."); + else{ + try{ + int index = Integer.parseInt(words[1]); + if(index>todolist.size()||index<=0) System.out.println("No task found."); + else{ + todolist.get(index-1).markAsDone(); + System.out.println("Nice! I've marked this task as done:"); + System.out.println((index)+". "+todolist.get(index-1).toString()); + } + } + catch (NumberFormatException ex){ + System.out.println("☹ OOPS!!! Please tell me the task number you want to mark."); } - } - catch (NumberFormatException ex){ - ex.printStackTrace(); } break; } case "unmark":{ - try{ - int index = Integer.parseInt(words[1]); - if(index>todolist.size()||index<=0) System.out.println("No task found."); - else { - todolist.get(index-1).markAsUndone(); - System.out.println("OK, I've marked this task as not done yet:"); - System.out.println((index)+". "+todolist.get(index-1).toString()); + if (words.length==1) + System.out.println("☹ OOPS!!! Please tell me the task you want to unmark."); + else{ + try{ + int index = Integer.parseInt(words[1]); + if(index>todolist.size()||index<=0) System.out.println("No task found."); + else { + todolist.get(index-1).markAsUndone(); + System.out.println("OK, I've marked this task as not done yet:"); + System.out.println((index)+". "+todolist.get(index-1).toString()); + } + } + catch (NumberFormatException ex){ + System.out.println("☹ OOPS!!! Please tell me the task number you want to unmark."); } - } - catch (NumberFormatException ex){ - ex.printStackTrace(); } break; } case "todo": { - todolist.add(new ToDo(words[1])); - System.out.println("Got it. I've added this task:"); - System.out.println(" " + todolist.get(todolist.size() - 1).toString()); - System.out.println("Now you have " + todolist.size() + " tasks in the list."); + if (words.length == 1) + System.out.println("☹ OOPS!!! The description of a todo cannot be empty."); + else { + todolist.add(new ToDo(words[1])); + System.out.println("Got it. I've added this task:"); + System.out.println(" " + todolist.get(todolist.size() - 1).toString()); + System.out.println("Now you have " + todolist.size() + " tasks in the list."); + } break; } case "deadline": { - String[] words1 = words[1].split("/by", 2); - todolist.add(new Deadline(words1[0], words1[1])); - System.out.println("Got it. I've added this task:"); - System.out.println(" " + todolist.get(todolist.size() - 1).toString()); - System.out.println("Now you have " + todolist.size() + " tasks in the list."); + if (words.length==1) + System.out.println("☹ OOPS!!! The information about the deadline is incomplete."); + else{ + try{ + String[] words1 = words[1].split("/by", 2); + todolist.add(new Deadline(words1[0], words1[1])); + System.out.println("Got it. I've added this task:"); + System.out.println(" " + todolist.get(todolist.size() - 1).toString()); + System.out.println("Now you have " + todolist.size() + " tasks in the list."); + } + catch(ArrayIndexOutOfBoundsException e){ + System.out.println("Could you type in the deadline with format:" + + " deadline {your task} /by {your deadline}?"); + } + } break; } case "event": { - String[] words1 = words[1].split("/at", 2); - todolist.add(new Event(words1[0], words1[1])); - System.out.println("Got it. I've added this task:"); - System.out.println(" " + todolist.get(todolist.size() - 1).toString()); - System.out.println("Now you have " + todolist.size() + " tasks in the list."); + if (words.length==1) + System.out.println("☹ OOPS!!! The information about the event is incomplete."); + else{ + try{ + String[] words1 = words[1].split("/at", 2); + todolist.add(new Event(words1[0], words1[1])); + System.out.println("Got it. I've added this task:"); + System.out.println(" " + todolist.get(todolist.size() - 1).toString()); + System.out.println("Now you have " + todolist.size() + " tasks in the list."); + } + catch(ArrayIndexOutOfBoundsException e){ + System.out.println("Could you type in the event with format:" + + " event {your task} /at {your event time}?"); + } + } break; } default: - System.out.println("Sorry,I don't understand what you are saying." + - " Could you please type again with given keywords?"); + System.out.println("☹ OOPS!!! I'm sorry, but I don't know what that means :-("); } task=in.nextLine(); } From 4c7f5d0f02e132b6e4a72ca8617348bdafacc92f Mon Sep 17 00:00:00 2001 From: Wang Jingwei Date: Tue, 15 Feb 2022 17:52:39 +0800 Subject: [PATCH 09/23] Add some error handlings. --- src/main/java/Duke.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/Duke.java b/src/main/java/Duke.java index 96f1b7e84..15c64bede 100644 --- a/src/main/java/Duke.java +++ b/src/main/java/Duke.java @@ -37,7 +37,7 @@ public static void main(String[] args) { System.out.println((index)+". "+todolist.get(index-1).toString()); } } - catch (NumberFormatException ex){ + catch (NumberFormatException e){ System.out.println("☹ OOPS!!! Please tell me the task number you want to mark."); } } From 4d255afb5bef61cfbee737434279461865fc1c4c Mon Sep 17 00:00:00 2001 From: Wang Jingwei Date: Tue, 15 Feb 2022 17:52:39 +0800 Subject: [PATCH 10/23] =?UTF-8?q?Merge=20branch=20=E2=80=9Cbranch-Level-5?= =?UTF-8?q?=E2=80=9D.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/Duke.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/Duke.java b/src/main/java/Duke.java index 96f1b7e84..15c64bede 100644 --- a/src/main/java/Duke.java +++ b/src/main/java/Duke.java @@ -37,7 +37,7 @@ public static void main(String[] args) { System.out.println((index)+". "+todolist.get(index-1).toString()); } } - catch (NumberFormatException ex){ + catch (NumberFormatException e){ System.out.println("☹ OOPS!!! Please tell me the task number you want to mark."); } } From dc33bec685012928480bb49ede9e947cba68bf77 Mon Sep 17 00:00:00 2001 From: Wang Jingwei Date: Tue, 15 Feb 2022 17:58:28 +0800 Subject: [PATCH 11/23] =?UTF-8?q?Revert=20"Merge=20branch=20=E2=80=9Cbranc?= =?UTF-8?q?h-Level-5=E2=80=9D."?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 4d255afb5bef61cfbee737434279461865fc1c4c. --- src/main/java/Duke.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/Duke.java b/src/main/java/Duke.java index 15c64bede..96f1b7e84 100644 --- a/src/main/java/Duke.java +++ b/src/main/java/Duke.java @@ -37,7 +37,7 @@ public static void main(String[] args) { System.out.println((index)+". "+todolist.get(index-1).toString()); } } - catch (NumberFormatException e){ + catch (NumberFormatException ex){ System.out.println("☹ OOPS!!! Please tell me the task number you want to mark."); } } From e07aeec57a4795c67925d8547c5646755532607f Mon Sep 17 00:00:00 2001 From: Wang Jingwei Date: Tue, 15 Feb 2022 18:05:45 +0800 Subject: [PATCH 12/23] Organise the classes into suitable java packages. --- src/main/java/{ => Tasks}/Deadline.java | 0 src/main/java/{ => Tasks}/Event.java | 0 src/main/java/{ => Tasks}/Task.java | 0 src/main/java/{ => Tasks}/ToDo.java | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename src/main/java/{ => Tasks}/Deadline.java (100%) rename src/main/java/{ => Tasks}/Event.java (100%) rename src/main/java/{ => Tasks}/Task.java (100%) rename src/main/java/{ => Tasks}/ToDo.java (100%) diff --git a/src/main/java/Deadline.java b/src/main/java/Tasks/Deadline.java similarity index 100% rename from src/main/java/Deadline.java rename to src/main/java/Tasks/Deadline.java diff --git a/src/main/java/Event.java b/src/main/java/Tasks/Event.java similarity index 100% rename from src/main/java/Event.java rename to src/main/java/Tasks/Event.java diff --git a/src/main/java/Task.java b/src/main/java/Tasks/Task.java similarity index 100% rename from src/main/java/Task.java rename to src/main/java/Tasks/Task.java diff --git a/src/main/java/ToDo.java b/src/main/java/Tasks/ToDo.java similarity index 100% rename from src/main/java/ToDo.java rename to src/main/java/Tasks/ToDo.java From 61d77374fdaee8a95df0d591361f604e3cfa5719 Mon Sep 17 00:00:00 2001 From: Wang Jingwei Date: Tue, 15 Feb 2022 18:06:43 +0800 Subject: [PATCH 13/23] Organise several classes into packages. --- src/main/java/Duke.java | 5 +++++ src/main/java/Tasks/Deadline.java | 4 ++++ src/main/java/Tasks/Event.java | 2 ++ src/main/java/Tasks/Task.java | 2 ++ src/main/java/Tasks/ToDo.java | 4 ++++ 5 files changed, 17 insertions(+) diff --git a/src/main/java/Duke.java b/src/main/java/Duke.java index 96f1b7e84..72ab4441b 100644 --- a/src/main/java/Duke.java +++ b/src/main/java/Duke.java @@ -1,3 +1,8 @@ +import Tasks.Deadline; +import Tasks.Event; +import Tasks.Task; +import Tasks.ToDo; + import java.util.Scanner; import java.util.ArrayList; public class Duke { diff --git a/src/main/java/Tasks/Deadline.java b/src/main/java/Tasks/Deadline.java index 885bade66..8a4a78b0e 100644 --- a/src/main/java/Tasks/Deadline.java +++ b/src/main/java/Tasks/Deadline.java @@ -1,3 +1,7 @@ +package Tasks; + +import Tasks.Task; + public class Deadline extends Task { protected String by; diff --git a/src/main/java/Tasks/Event.java b/src/main/java/Tasks/Event.java index 2b033012a..d32754df6 100644 --- a/src/main/java/Tasks/Event.java +++ b/src/main/java/Tasks/Event.java @@ -1,3 +1,5 @@ +package Tasks; + public class Event extends Task { protected String at; diff --git a/src/main/java/Tasks/Task.java b/src/main/java/Tasks/Task.java index c481fc249..da13a4ad9 100644 --- a/src/main/java/Tasks/Task.java +++ b/src/main/java/Tasks/Task.java @@ -1,3 +1,5 @@ +package Tasks; + public class Task { protected String description; protected boolean isDone; diff --git a/src/main/java/Tasks/ToDo.java b/src/main/java/Tasks/ToDo.java index 25be5ee3c..d68abf41f 100644 --- a/src/main/java/Tasks/ToDo.java +++ b/src/main/java/Tasks/ToDo.java @@ -1,3 +1,7 @@ +package Tasks; + +import Tasks.Task; + public class ToDo extends Task { public ToDo(String description) { From fedb1649175886572855750f0b7875bb8525f6a2 Mon Sep 17 00:00:00 2001 From: Wang Jingwei Date: Wed, 16 Feb 2022 11:32:32 +0800 Subject: [PATCH 14/23] Add the delete functionality. --- src/main/java/Duke.java | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/main/java/Duke.java b/src/main/java/Duke.java index 72ab4441b..d652b86a5 100644 --- a/src/main/java/Duke.java +++ b/src/main/java/Duke.java @@ -114,6 +114,26 @@ public static void main(String[] args) { } break; } + case "delete":{ + if (words.length==1) + System.out.println("☹ OOPS!!! Please tell me the task you want to delete."); + else{ + try{ + int index = Integer.parseInt(words[1]); + if(index>todolist.size()||index<=0) System.out.println("No task found."); + else{ + System.out.println("Noted. I've removed this task:"); + System.out.println((index)+". "+todolist.get(index-1).toString()); + todolist.remove(index-1); + System.out.println("Now you have " + todolist.size() + " tasks in the list."); + } + } + catch (NumberFormatException ex){ + System.out.println("☹ OOPS!!! Please tell me the task number you want to delete."); + } + } + break; + } default: System.out.println("☹ OOPS!!! I'm sorry, but I don't know what that means :-("); } From 9fc8cb9b9d72f66aa269ea324d04df75a7a5654d Mon Sep 17 00:00:00 2001 From: Wang Jingwei Date: Wed, 16 Feb 2022 17:45:37 +0800 Subject: [PATCH 15/23] Add the functionality to load data from the file and save data into the file. --- data.txt | 5 ++++ src/main/java/Duke.java | 48 +++++++++++++++++++++++++++++-- src/main/java/FileManager.java | 30 +++++++++++++++++++ src/main/java/Tasks/Deadline.java | 5 ++++ src/main/java/Tasks/Event.java | 5 ++++ src/main/java/Tasks/Task.java | 3 ++ src/main/java/Tasks/ToDo.java | 5 ++++ 7 files changed, 99 insertions(+), 2 deletions(-) create mode 100644 data.txt create mode 100644 src/main/java/FileManager.java diff --git a/data.txt b/data.txt new file mode 100644 index 000000000..78ff4bbe7 --- /dev/null +++ b/data.txt @@ -0,0 +1,5 @@ +T,false,eat food +D,true,return book , Sunday +E,true,project meeting , Mon 2-4pm +T,false,borrow book +E,true,haha , Monday diff --git a/src/main/java/Duke.java b/src/main/java/Duke.java index 72ab4441b..4462d3a92 100644 --- a/src/main/java/Duke.java +++ b/src/main/java/Duke.java @@ -3,18 +3,46 @@ import Tasks.Task; import Tasks.ToDo; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; import java.util.Scanner; import java.util.ArrayList; +import java.io.BufferedReader; + public class Duke { - public static void main(String[] args) { + public static void main(String[] args) throws IOException { String logo = " ____ _ \n" + "| _ \\ _ _| | _____ \n" + "| | | | | | | |/ / _ \\\n" + "| |_| | |_| | < __/\n" + "|____/ \\__,_|_|\\_\\___|\n"; + System.out.println("Hello from\n" + logo); + FileManager.create(); ArrayList todolist = new ArrayList(); + BufferedReader br = new BufferedReader(new FileReader("data.txt")); + String taskLine; + while ((taskLine = br.readLine())!=null) { + String[] t = taskLine.split(","); + switch (t[0]) { + case "T": + ToDo todo = new ToDo(t[2]); + todolist.add(todo); + break; + case "D": + Deadline deadline = new Deadline(t[2], t[3]); + todolist.add(deadline); + break; + case "E": + Event event = new Event(t[2], t[3]); + todolist.add(event); + break; + } + if (t.length>1&&t[1].equals("true")) + todolist.get(todolist.size() - 1).markAsDone(); + } + br.close(); String task; - System.out.println("Hello from\n" + logo); System.out.println("Hello! I'm Duke\nWhat can I do for you?"); Scanner in = new Scanner(System.in); task=in.nextLine(); @@ -119,6 +147,22 @@ public static void main(String[] args) { } task=in.nextLine(); } + String taskAllInfo=""; + for(Task k: todolist){ + String taskInfo = k.getType()+","+k.getStatus()+","+k.getDescription(); + if(k.getType()=="D") { + Deadline d = (Deadline) k; + taskInfo = taskInfo + "," + d.getBy(); + } + else if(k.getType()=="E"){ + Event e = (Event) k; + taskInfo = taskInfo + "," + e.getAt(); + } + taskAllInfo+=taskInfo+"\n"; + } + if (taskAllInfo!=null) taskAllInfo=taskAllInfo.substring(0, taskAllInfo.length() - 1); + FileManager.save(taskAllInfo); System.out.println("Bye.Have a nice day!"); } } + diff --git a/src/main/java/FileManager.java b/src/main/java/FileManager.java new file mode 100644 index 000000000..9c289bf72 --- /dev/null +++ b/src/main/java/FileManager.java @@ -0,0 +1,30 @@ +import java.io.File; +import java.io.IOException; +import java.io.FileWriter; +import java.io.FileNotFoundException; +import java.util.Scanner; + +public class FileManager { + public static void create(){ + try { + File data = new File("data.txt"); + if (data.createNewFile()) { + System.out.println("No data file detected, I have created a new data file for you!"); + } else { + System.out.println("I have successfully loaded the data file!"); + } + } catch (IOException e) { + System.out.println("An error occurred."); + } + } + + public static void save(String textToAdd) throws IOException { + FileWriter fw = new FileWriter("data.txt",false); + try { + fw.write(textToAdd+System.lineSeparator()); + } catch (IOException e) { + System.out.println("Something went wrong, the data is not successfully saved in the file."); + } + fw.close(); + } +} diff --git a/src/main/java/Tasks/Deadline.java b/src/main/java/Tasks/Deadline.java index 8a4a78b0e..55c776d72 100644 --- a/src/main/java/Tasks/Deadline.java +++ b/src/main/java/Tasks/Deadline.java @@ -23,4 +23,9 @@ public String getBy(){ public String toString() { return "[D]" + super.toString() + " (by:" + by + ")"; } + + @Override + public String getType() { + return "D"; + } } diff --git a/src/main/java/Tasks/Event.java b/src/main/java/Tasks/Event.java index d32754df6..6a085d5f1 100644 --- a/src/main/java/Tasks/Event.java +++ b/src/main/java/Tasks/Event.java @@ -21,5 +21,10 @@ public String getAt(){ public String toString() { return "[E]" + super.toString() + " (at:" + at + ")"; } + + @Override + public String getType() { + return "E"; + } } diff --git a/src/main/java/Tasks/Task.java b/src/main/java/Tasks/Task.java index da13a4ad9..cd0605fbd 100644 --- a/src/main/java/Tasks/Task.java +++ b/src/main/java/Tasks/Task.java @@ -9,6 +9,8 @@ public Task(String description) { this.isDone = false; } + public boolean getStatus(){return isDone;} + public String getStatusIcon() { return (isDone ? "X" : " "); // mark done task with X } @@ -31,4 +33,5 @@ public void markAsUndone(){ public String toString(){ return "["+getStatusIcon()+"] "+description; } + public String getType(){return null;} } diff --git a/src/main/java/Tasks/ToDo.java b/src/main/java/Tasks/ToDo.java index d68abf41f..05416ce50 100644 --- a/src/main/java/Tasks/ToDo.java +++ b/src/main/java/Tasks/ToDo.java @@ -12,4 +12,9 @@ public ToDo(String description) { public String toString() { return "[T]" + super.toString(); } + + @Override + public String getType() { + return "T"; + } } \ No newline at end of file From cf92441832aaf2ea70d0693242bd62e85858850e Mon Sep 17 00:00:00 2001 From: Wang Jingwei Date: Wed, 16 Feb 2022 18:24:07 +0800 Subject: [PATCH 16/23] Add manifest. --- src/main/java/META-INF/MANIFEST.MF | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 src/main/java/META-INF/MANIFEST.MF diff --git a/src/main/java/META-INF/MANIFEST.MF b/src/main/java/META-INF/MANIFEST.MF new file mode 100644 index 000000000..d2ffd5b4d --- /dev/null +++ b/src/main/java/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Main-Class: Duke + From c2999c8bd23fde08df937d9d51956333761fb593 Mon Sep 17 00:00:00 2001 From: Wang Jingwei Date: Sun, 27 Feb 2022 15:10:13 +0800 Subject: [PATCH 17/23] Push the design more towards the OOP approach. --- data.txt | 4 +- src/main/java/Duke.java | 150 +++++++++--------------------- src/main/java/FileManager.java | 30 ------ src/main/java/Storage.java | 79 ++++++++++++++++ src/main/java/Tasks/Deadline.java | 2 - src/main/java/Tasks/ToDo.java | 2 - src/main/java/Ui.java | 115 +++++++++++++++++++++++ 7 files changed, 240 insertions(+), 142 deletions(-) delete mode 100644 src/main/java/FileManager.java create mode 100644 src/main/java/Storage.java create mode 100644 src/main/java/Ui.java diff --git a/data.txt b/data.txt index 78ff4bbe7..fa615beb8 100644 --- a/data.txt +++ b/data.txt @@ -1,5 +1,5 @@ T,false,eat food D,true,return book , Sunday -E,true,project meeting , Mon 2-4pm T,false,borrow book -E,true,haha , Monday +E,false,haha , Monday +D,false,120 songs , Tomorrow diff --git a/src/main/java/Duke.java b/src/main/java/Duke.java index 4787743a7..02f7b0c15 100644 --- a/src/main/java/Duke.java +++ b/src/main/java/Duke.java @@ -1,49 +1,28 @@ -import Tasks.Deadline; -import Tasks.Event; -import Tasks.Task; -import Tasks.ToDo; - -import java.io.FileNotFoundException; -import java.io.FileReader; +import Tasks.*; import java.io.IOException; import java.util.Scanner; import java.util.ArrayList; -import java.io.BufferedReader; public class Duke { - public static void main(String[] args) throws IOException { - String logo = " ____ _ \n" - + "| _ \\ _ _| | _____ \n" - + "| | | | | | | |/ / _ \\\n" - + "| |_| | |_| | < __/\n" - + "|____/ \\__,_|_|\\_\\___|\n"; - System.out.println("Hello from\n" + logo); - FileManager.create(); - ArrayList todolist = new ArrayList(); - BufferedReader br = new BufferedReader(new FileReader("data.txt")); - String taskLine; - while ((taskLine = br.readLine())!=null) { - String[] t = taskLine.split(","); - switch (t[0]) { - case "T": - ToDo todo = new ToDo(t[2]); - todolist.add(todo); - break; - case "D": - Deadline deadline = new Deadline(t[2], t[3]); - todolist.add(deadline); - break; - case "E": - Event event = new Event(t[2], t[3]); - todolist.add(event); - break; - } - if (t.length>1&&t[1].equals("true")) - todolist.get(todolist.size() - 1).markAsDone(); + private Storage storage; + private ArrayList todolist = new ArrayList(); + private Ui ui; + + public Duke(String filePath){ + ui = new Ui(); + storage = new Storage(filePath); + Storage.create(filePath); + try { + todolist = new ArrayList(storage.load()); + } catch (IOException e) { + ui.showLoadingError(); + todolist = new ArrayList(); } - br.close(); + } + + public void run() throws IOException { String task; - System.out.println("Hello! I'm Duke\nWhat can I do for you?"); + ui.greetings(); Scanner in = new Scanner(System.in); task=in.nextLine(); while(true){ @@ -52,137 +31,96 @@ public static void main(String[] args) throws IOException { String[] words = task.split(" ",2); switch (words[0].toLowerCase()){ case "list":{ - System.out.println("Here are the tasks in your list:"); - for (int i = 0; i < todolist.size(); i++) - System.out.println((i+1)+". "+todolist.get(i).toString()); - break; + ui.displayTasks(todolist); + break; } case "mark":{ if (words.length==1) - System.out.println("☹ OOPS!!! Please tell me the task you want to mark."); + ui.incompleteMessage("mark"); else{ try{ int index = Integer.parseInt(words[1]); if(index>todolist.size()||index<=0) System.out.println("No task found."); - else{ - todolist.get(index-1).markAsDone(); - System.out.println("Nice! I've marked this task as done:"); - System.out.println((index)+". "+todolist.get(index-1).toString()); - } + else ui.markAndDisplayTask(todolist,index); } catch (NumberFormatException ex){ - System.out.println("☹ OOPS!!! Please tell me the task number you want to mark."); + ui.showNumberError(); } } break; } case "unmark":{ if (words.length==1) - System.out.println("☹ OOPS!!! Please tell me the task you want to unmark."); + ui.incompleteMessage("unmark"); else{ try{ int index = Integer.parseInt(words[1]); if(index>todolist.size()||index<=0) System.out.println("No task found."); - else { - todolist.get(index-1).markAsUndone(); - System.out.println("OK, I've marked this task as not done yet:"); - System.out.println((index)+". "+todolist.get(index-1).toString()); - } + else ui.unmarkAndDisplayTask(todolist,index); } catch (NumberFormatException ex){ - System.out.println("☹ OOPS!!! Please tell me the task number you want to unmark."); + ui.showNumberError(); } } break; } case "todo": { - if (words.length == 1) - System.out.println("☹ OOPS!!! The description of a todo cannot be empty."); - else { - todolist.add(new ToDo(words[1])); - System.out.println("Got it. I've added this task:"); - System.out.println(" " + todolist.get(todolist.size() - 1).toString()); - System.out.println("Now you have " + todolist.size() + " tasks in the list."); - } + if (words.length == 1) ui.incompleteMessage("todo"); + else ui.addToDo(todolist,words[1]); break; } case "deadline": { if (words.length==1) - System.out.println("☹ OOPS!!! The information about the deadline is incomplete."); + ui.incompleteMessage("deadline"); else{ try{ - String[] words1 = words[1].split("/by", 2); - todolist.add(new Deadline(words1[0], words1[1])); - System.out.println("Got it. I've added this task:"); - System.out.println(" " + todolist.get(todolist.size() - 1).toString()); - System.out.println("Now you have " + todolist.size() + " tasks in the list."); + ui.addDeadline(todolist,words[1]); } catch(ArrayIndexOutOfBoundsException e){ - System.out.println("Could you type in the deadline with format:" + - " deadline {your task} /by {your deadline}?"); + ui.showFormattingError("deadline"); } } break; } case "event": { if (words.length==1) - System.out.println("☹ OOPS!!! The information about the event is incomplete."); + ui.incompleteMessage("event"); else{ try{ - String[] words1 = words[1].split("/at", 2); - todolist.add(new Event(words1[0], words1[1])); - System.out.println("Got it. I've added this task:"); - System.out.println(" " + todolist.get(todolist.size() - 1).toString()); - System.out.println("Now you have " + todolist.size() + " tasks in the list."); + ui.addEvent(todolist,words[1]); } catch(ArrayIndexOutOfBoundsException e){ - System.out.println("Could you type in the event with format:" + - " event {your task} /at {your event time}?"); + ui.showFormattingError("event"); } } break; } case "delete":{ if (words.length==1) - System.out.println("☹ OOPS!!! Please tell me the task you want to delete."); + ui.incompleteMessage("delete"); else{ try{ int index = Integer.parseInt(words[1]); if(index>todolist.size()||index<=0) System.out.println("No task found."); - else{ - System.out.println("Noted. I've removed this task:"); - System.out.println((index)+". "+todolist.get(index-1).toString()); - todolist.remove(index-1); - System.out.println("Now you have " + todolist.size() + " tasks in the list."); - } + else ui.deleteTask(todolist,index); } catch (NumberFormatException ex){ - System.out.println("☹ OOPS!!! Please tell me the task number you want to delete."); + ui.showNumberError(); } } break; } default: - System.out.println("☹ OOPS!!! I'm sorry, but I don't know what that means :-("); + ui.displayDefaultMessage(); } task=in.nextLine(); } - String taskAllInfo=""; - for(Task k: todolist){ - String taskInfo = k.getType()+","+k.getStatus()+","+k.getDescription(); - if(k.getType()=="D") { - Deadline d = (Deadline) k; - taskInfo = taskInfo + "," + d.getBy(); - } - else if(k.getType()=="E"){ - Event e = (Event) k; - taskInfo = taskInfo + "," + e.getAt(); - } - taskAllInfo+=taskInfo+"\n"; - } - if (taskAllInfo!=null) taskAllInfo=taskAllInfo.substring(0, taskAllInfo.length() - 1); - FileManager.save(taskAllInfo); - System.out.println("Bye.Have a nice day!"); + Storage.save(Storage.format(todolist),"data.txt"); + ui.goodBye(); + } + + public static void main(String[] args) throws IOException { + new Duke("data.txt").run(); } } diff --git a/src/main/java/FileManager.java b/src/main/java/FileManager.java deleted file mode 100644 index 9c289bf72..000000000 --- a/src/main/java/FileManager.java +++ /dev/null @@ -1,30 +0,0 @@ -import java.io.File; -import java.io.IOException; -import java.io.FileWriter; -import java.io.FileNotFoundException; -import java.util.Scanner; - -public class FileManager { - public static void create(){ - try { - File data = new File("data.txt"); - if (data.createNewFile()) { - System.out.println("No data file detected, I have created a new data file for you!"); - } else { - System.out.println("I have successfully loaded the data file!"); - } - } catch (IOException e) { - System.out.println("An error occurred."); - } - } - - public static void save(String textToAdd) throws IOException { - FileWriter fw = new FileWriter("data.txt",false); - try { - fw.write(textToAdd+System.lineSeparator()); - } catch (IOException e) { - System.out.println("Something went wrong, the data is not successfully saved in the file."); - } - fw.close(); - } -} diff --git a/src/main/java/Storage.java b/src/main/java/Storage.java new file mode 100644 index 000000000..0be053c9b --- /dev/null +++ b/src/main/java/Storage.java @@ -0,0 +1,79 @@ +import Tasks.*; +import java.io.*; +import java.util.*; + +public class Storage { + protected String filePath; + public Storage(String filePath) { + this.filePath = filePath; + } + + public static void create(String filePath){ + try { + File data = new File(filePath); + if (data.createNewFile()) { + System.out.println("No data file detected, I have created a new data file for you!"); + } else { + System.out.println("I have found the file and loading the data for you!"); + } + } catch (IOException e) { + System.out.println("An error occurred during file searching."); + } + } + + public static void save(String textToAdd,String filePath) throws IOException { + FileWriter fw = new FileWriter(filePath,false); + try { + fw.write(textToAdd+System.lineSeparator()); + } catch (IOException e) { + System.out.println("Something went wrong, the data is not successfully saved in the file."); + } + fw.close(); + } + + public ArrayList load() throws IOException { + ArrayList todolist = new ArrayList(); + BufferedReader br = new BufferedReader(new FileReader(this.filePath)); + String taskLine; + while ((taskLine = br.readLine())!=null) { + String[] t = taskLine.split(","); + switch (t[0]) { + case "T": + ToDo todo = new ToDo(t[2]); + todolist.add(todo); + break; + case "D": + Deadline deadline = new Deadline(t[2], t[3]); + todolist.add(deadline); + break; + case "E": + Event event = new Event(t[2], t[3]); + todolist.add(event); + break; + } + if (t.length>1&&t[1].equals("true")) + todolist.get(todolist.size() - 1).markAsDone(); + } + br.close(); + System.out.println("I have successfully loaded the file for you!"); + return todolist; + } + + public static String format(ArrayList taskList){ + String taskAllInfo=""; + for(Task k: taskList){ + String taskInfo = k.getType()+","+k.getStatus()+","+k.getDescription(); + if(k.getType()=="D") { + Deadline d = (Deadline) k; + taskInfo = taskInfo + "," + d.getBy(); + } + else if(k.getType()=="E"){ + Event e = (Event) k; + taskInfo = taskInfo + "," + e.getAt(); + } + taskAllInfo+=taskInfo+"\n"; + } + if (taskAllInfo!=null) taskAllInfo=taskAllInfo.substring(0, taskAllInfo.length() - 1); + return taskAllInfo; + } +} diff --git a/src/main/java/Tasks/Deadline.java b/src/main/java/Tasks/Deadline.java index 55c776d72..52637c985 100644 --- a/src/main/java/Tasks/Deadline.java +++ b/src/main/java/Tasks/Deadline.java @@ -1,7 +1,5 @@ package Tasks; -import Tasks.Task; - public class Deadline extends Task { protected String by; diff --git a/src/main/java/Tasks/ToDo.java b/src/main/java/Tasks/ToDo.java index 05416ce50..782199d60 100644 --- a/src/main/java/Tasks/ToDo.java +++ b/src/main/java/Tasks/ToDo.java @@ -1,7 +1,5 @@ package Tasks; -import Tasks.Task; - public class ToDo extends Task { public ToDo(String description) { diff --git a/src/main/java/Ui.java b/src/main/java/Ui.java new file mode 100644 index 000000000..cc321bfdf --- /dev/null +++ b/src/main/java/Ui.java @@ -0,0 +1,115 @@ +import Tasks.*; +import java.util.ArrayList; + +public class Ui { + public void greetings(){ + String logo = " ____ _ \n" + + "| _ \\ _ _| | _____ \n" + + "| | | | | | | |/ / _ \\\n" + + "| |_| | |_| | < __/\n" + + "|____/ \\__,_|_|\\_\\___|\n"; + System.out.println("Hello from\n" + logo); + System.out.println("Hello! I'm Duke\nWhat can I do for you?"); + } + + public void goodBye() { + System.out.println("Bye.Have a nice day!"); + } + + public void displayTasks(ArrayList taskList){ + System.out.println("Here are the tasks in your list:"); + for (int i = 0; i < taskList.size(); i++) + System.out.println((i+1)+". "+taskList.get(i).toString()); + } + + public void incompleteMessage(String type) { + switch (type) { + case "mark": + System.out.println("☹ OOPS!!! Please tell me the task you want to mark."); + break; + case "unmark": + System.out.println("☹ OOPS!!! Please tell me the task you want to unmark."); + break; + case "todo": + System.out.println("☹ OOPS!!! The description of a todo cannot be empty."); + break; + case "deadline": + System.out.println("OOPS!!! The information about the deadline is incomplete."); + break; + case "event": + System.out.println("☹ OOPS!!! The information about the event is incomplete."); + break; + case "delete": + System.out.println("☹ OOPS!!! Please tell me the task you want to delete."); + break; + } + } + + public void addTaskMessage(ArrayList taskList){ + System.out.println("Got it. I've added this task:"); + System.out.println(" " + taskList.get(taskList.size() - 1).toString()); + System.out.println("Now you have " + taskList.size() + " tasks in the list."); + } + + public void markAndDisplayTask(ArrayList taskList, int index){ + taskList.get(index-1).markAsDone(); + System.out.println("Nice! I've marked this task as done:"); + System.out.println((index)+". "+taskList.get(index-1).toString()); + } + + public void unmarkAndDisplayTask(ArrayList taskList, int index){ + taskList.get(index-1).markAsUndone(); + System.out.println("OK, I've marked this task as not done yet:"); + System.out.println((index)+". "+taskList.get(index-1).toString()); + } + + public void addToDo(ArrayList taskList, String todo){ + taskList.add(new ToDo(todo)); + addTaskMessage(taskList); + } + + public void addDeadline(ArrayList taskList, String deadline){ + String[] deadline1 = deadline.split("/by", 2); + taskList.add(new Deadline(deadline1[0], deadline1[1])); + addTaskMessage(taskList); + } + + public void addEvent(ArrayList taskList, String event){ + String[] event1 = event.split("/at", 2); + taskList.add(new Event(event1[0], event1[1])); + addTaskMessage(taskList); + } + + public void deleteTask(ArrayList taskList, int index){ + System.out.println("Noted. I've removed this task:"); + System.out.println((index)+". "+taskList.get(index-1).toString()); + taskList.remove(index-1); + System.out.println("Now you have " + taskList.size() + " tasks in the list."); + } + + public void displayDefaultMessage(){ + System.out.println("☹ OOPS!!! I'm sorry, but I don't know what that means :-("); + } + + public void showNumberError(){ + System.out.println("☹ OOPS!!! Please tell me the task number you want to mark/unmark/delete."); + } + + public void showFormattingError(String type){ + switch(type){ + case "deadline": + System.out.println("Could you type in the deadline with format:" + + " deadline {your task} /by {your deadline}?"); + break; + case "event": + System.out.println("Could you type in the event with format:" + + " event {your task} /at {your event time}?"); + break; + } + } + + public void showLoadingError(){ + System.out.println("The loading process is unsuccessful."); + } +} + From 4bbced044eefbc42441b4937ceebbc934e2e82b1 Mon Sep 17 00:00:00 2001 From: Wang Jingwei Date: Sun, 27 Feb 2022 16:41:37 +0800 Subject: [PATCH 18/23] Add the find functionality. --- src/main/java/Duke.java | 5 +++++ src/main/java/Ui.java | 16 ++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/main/java/Duke.java b/src/main/java/Duke.java index 02f7b0c15..b5c8f29f5 100644 --- a/src/main/java/Duke.java +++ b/src/main/java/Duke.java @@ -110,6 +110,11 @@ public void run() throws IOException { } break; } + case "find": { + if (words.length == 1) ui.incompleteMessage("find"); + else ui.displayFoundTasks(todolist, words[1]); + break; + } default: ui.displayDefaultMessage(); } diff --git a/src/main/java/Ui.java b/src/main/java/Ui.java index cc321bfdf..7c51b664c 100644 --- a/src/main/java/Ui.java +++ b/src/main/java/Ui.java @@ -42,6 +42,9 @@ public void incompleteMessage(String type) { case "delete": System.out.println("☹ OOPS!!! Please tell me the task you want to delete."); break; + case "find": + System.out.println("☹ OOPS!!! Please tell me the task you want to find."); + break; } } @@ -111,5 +114,18 @@ public void showFormattingError(String type){ public void showLoadingError(){ System.out.println("The loading process is unsuccessful."); } + + public void displayFoundTasks(ArrayList taskList, String keyword){ + int count=1; + System.out.println("Here are the matching tasks in your list:"); + for(Task t: taskList){ + if(t.getDescription().toUpperCase().contains(keyword.toUpperCase())){ + System.out.println(count+". "+ t); + count++; + } + } + if(count==1) + System.out.println("No matched tasks!"); + } } From f28f85142696923d3a00438d85037dfacdd45d44 Mon Sep 17 00:00:00 2001 From: Wang Jingwei Date: Sun, 27 Feb 2022 17:24:27 +0800 Subject: [PATCH 19/23] Add javaDoc. --- src/main/java/Duke.java | 4 +++ src/main/java/Storage.java | 25 +++++++++++++++++++ src/main/java/Tasks/Deadline.java | 3 +++ src/main/java/Tasks/Event.java | 3 +++ src/main/java/Tasks/Task.java | 3 +++ src/main/java/Tasks/ToDo.java | 3 +++ src/main/java/Ui.java | 41 +++++++++++++++++++++++++++++++ 7 files changed, 82 insertions(+) diff --git a/src/main/java/Duke.java b/src/main/java/Duke.java index 02f7b0c15..6fdf86cce 100644 --- a/src/main/java/Duke.java +++ b/src/main/java/Duke.java @@ -8,6 +8,10 @@ public class Duke { private ArrayList todolist = new ArrayList(); private Ui ui; + /** + * Initialize the Duke. + * @param filePath + */ public Duke(String filePath){ ui = new Ui(); storage = new Storage(filePath); diff --git a/src/main/java/Storage.java b/src/main/java/Storage.java index 0be053c9b..6f31ed4d3 100644 --- a/src/main/java/Storage.java +++ b/src/main/java/Storage.java @@ -2,12 +2,19 @@ import java.io.*; import java.util.*; +/** + * Include all the file operations such as loading tasks from the file and saving tasks in the file. + */ public class Storage { protected String filePath; public Storage(String filePath) { this.filePath = filePath; } + /** + * Find the file according to the given filepath. If the file has not been created, create the file/ + * @param filePath + */ public static void create(String filePath){ try { File data = new File(filePath); @@ -21,6 +28,13 @@ public static void create(String filePath){ } } + /** + * Save the information into the file. + * @param textToAdd Texts going to be saved in the file. + * @param filePath + * @throws IOException + */ + public static void save(String textToAdd,String filePath) throws IOException { FileWriter fw = new FileWriter(filePath,false); try { @@ -31,6 +45,11 @@ public static void save(String textToAdd,String filePath) throws IOException { fw.close(); } + /** + * Add the information in the given file into an arraylist. + * @return Arraylist loaded from the file. + * @throws IOException + */ public ArrayList load() throws IOException { ArrayList todolist = new ArrayList(); BufferedReader br = new BufferedReader(new FileReader(this.filePath)); @@ -59,6 +78,12 @@ public ArrayList load() throws IOException { return todolist; } + /** + * format the information in the arraylist into a string. + * @param taskList Arraylist going to be formatted. + * @return String formatted from the tasklist. + */ + public static String format(ArrayList taskList){ String taskAllInfo=""; for(Task k: taskList){ diff --git a/src/main/java/Tasks/Deadline.java b/src/main/java/Tasks/Deadline.java index 52637c985..8f6d817e7 100644 --- a/src/main/java/Tasks/Deadline.java +++ b/src/main/java/Tasks/Deadline.java @@ -1,5 +1,8 @@ package Tasks; +/** + * Represents a kind of task that needs to be done before a specific date/time. + */ public class Deadline extends Task { protected String by; diff --git a/src/main/java/Tasks/Event.java b/src/main/java/Tasks/Event.java index 6a085d5f1..b05bc5a1c 100644 --- a/src/main/java/Tasks/Event.java +++ b/src/main/java/Tasks/Event.java @@ -1,5 +1,8 @@ package Tasks; +/** + * Represents a kind of task that starts at a specific time and ends at a specific time. + */ public class Event extends Task { protected String at; diff --git a/src/main/java/Tasks/Task.java b/src/main/java/Tasks/Task.java index cd0605fbd..88ec33c75 100644 --- a/src/main/java/Tasks/Task.java +++ b/src/main/java/Tasks/Task.java @@ -1,5 +1,8 @@ package Tasks; +/** + * Represents a general concept. + */ public class Task { protected String description; protected boolean isDone; diff --git a/src/main/java/Tasks/ToDo.java b/src/main/java/Tasks/ToDo.java index 782199d60..c582687e8 100644 --- a/src/main/java/Tasks/ToDo.java +++ b/src/main/java/Tasks/ToDo.java @@ -1,5 +1,8 @@ package Tasks; +/** + * Represents a kind of task without any date/time attached to it. + */ public class ToDo extends Task { public ToDo(String description) { diff --git a/src/main/java/Ui.java b/src/main/java/Ui.java index cc321bfdf..d52816625 100644 --- a/src/main/java/Ui.java +++ b/src/main/java/Ui.java @@ -1,6 +1,9 @@ import Tasks.*; import java.util.ArrayList; +/** + * Interactions with the user. + */ public class Ui { public void greetings(){ String logo = " ____ _ \n" @@ -16,12 +19,20 @@ public void goodBye() { System.out.println("Bye.Have a nice day!"); } + /** + * Display the information regarding tasks. + * @param taskList Arraylist containing task information. + */ public void displayTasks(ArrayList taskList){ System.out.println("Here are the tasks in your list:"); for (int i = 0; i < taskList.size(); i++) System.out.println((i+1)+". "+taskList.get(i).toString()); } + /** + * Display the incomplete information message given the input type. + * @param type Type of instruction given by the user. + */ public void incompleteMessage(String type) { switch (type) { case "mark": @@ -51,35 +62,65 @@ public void addTaskMessage(ArrayList taskList){ System.out.println("Now you have " + taskList.size() + " tasks in the list."); } + /** + * Mark the corresponding task as done and display the successful message. + * @param taskList Arraylist containing task information. + * @param index Index of the task which will be marked as done. + */ public void markAndDisplayTask(ArrayList taskList, int index){ taskList.get(index-1).markAsDone(); System.out.println("Nice! I've marked this task as done:"); System.out.println((index)+". "+taskList.get(index-1).toString()); } + /** + * Mark the corresponding task as undone and display the successful message. + * @param taskList Arraylist containing task information. + * @param index Index of the task which will be marked as undone. + */ public void unmarkAndDisplayTask(ArrayList taskList, int index){ taskList.get(index-1).markAsUndone(); System.out.println("OK, I've marked this task as not done yet:"); System.out.println((index)+". "+taskList.get(index-1).toString()); } + /** + * Add the task as ToDo. + * @param taskList Arraylist containing task information. + * @param todo Description of the task which will be added as ToDo. + */ public void addToDo(ArrayList taskList, String todo){ taskList.add(new ToDo(todo)); addTaskMessage(taskList); } + /** + * Add the task as deadline. + * @param taskList Arraylist containing task information. + * @param deadline Description of the task which will be added as Deadline. + */ public void addDeadline(ArrayList taskList, String deadline){ String[] deadline1 = deadline.split("/by", 2); taskList.add(new Deadline(deadline1[0], deadline1[1])); addTaskMessage(taskList); } + /** + * Add the task as event. + * @param taskList Arraylist containing task information. + * @param event Description of the task which will be added as Event. + */ public void addEvent(ArrayList taskList, String event){ String[] event1 = event.split("/at", 2); taskList.add(new Event(event1[0], event1[1])); addTaskMessage(taskList); } + /** + * Delete the corresponding task. + * @param taskList Arraylist containing task information. + * @param index Index of the task which will be deleted. + */ public void deleteTask(ArrayList taskList, int index){ System.out.println("Noted. I've removed this task:"); System.out.println((index)+". "+taskList.get(index-1).toString()); From 9c5aaa1507ca8d04f25222f5a2217b9bce817c1e Mon Sep 17 00:00:00 2001 From: wwwleah <69473846+Wang-Jingwei@users.noreply.github.com> Date: Mon, 28 Feb 2022 01:06:37 +0800 Subject: [PATCH 20/23] Update README.md --- docs/README.md | 107 +++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 94 insertions(+), 13 deletions(-) diff --git a/docs/README.md b/docs/README.md index 8077118eb..a6c1488c9 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,29 +1,110 @@ -# User Guide +# User Guide for Doke +**Duke** is a Personal Assistant Chatbot that helps a person to keep track of various tasks via a **Command Line Interface**. ## Features +1. Add a ToDo task +2. Add a Deadline task +3. Add an event task +4. delete a specific task +5. Mark a task as done +6. Mark a task as undone +7. Display the current task list +8. find the tasks with given keyword +9. Load and save the data automatically +10. Exit the program -### Feature-ABC +## Usage -Description of the feature. +### Add a task: `taskType description (time)` -### Feature-XYZ +**Format**: + +- TODO: `TODO description`. **Example**: `TODO borrow book` -Description of the feature. +- DEADLINE: `DEADLINE description /by deadlineTime`. **Example**: `DEADLINE return book /by Sunday` + +- EVENT: `EVENT description /at eventTime`. **Example**: `EVENT project meeting /at Mon 2-4pm` + +**Expected outcome (Deadline as an example)**: + +``` +Got it. I've added this task: + [D][ ] return book (by: Sunday) +Now you have 6 tasks in the list. +``` -## Usage +### Delete a task: `delete` + +Delete certain task based on its index. + +**Format**: `delete taskIndex` + +**Expected outcome**: +``` +Noted. I've removed this task: + [D][ ] return book (by: Sunday) +Now you have 5 tasks in the list. +``` + +### Mark a task as done/undone: `mark/unmark` + +Mark a task as done/undone based on given index. The default status of a task is **undone**. + +**Format**: + +- mark: `mark taskIndex`. **Example**: `mark 2` + +- unmark: `unmark taskIndex`. **Example**: `unmark 2` + +**Expected outcome (mark as example)**: +``` +Nice! I've marked this task as done: +3. [T][X] borrow book +``` + +### Display the current task list: `list` -### `Keyword` - Describe action +**Format**: `list` -Describe the action and its outcome. +**Expected outcome**: +``` +Here are the tasks in your list: +1. [T][ ] eat food +2. [D][X] return book (by: Sunday) +3. [T][X] borrow book +4. [E][ ] study CS2113 (at: Monday) +``` -Example of usage: +### Find the tasks with given keyword: `find` -`keyword (optional arguments)` +**Format**: `find keyword` + +**Example**: `find book` + +**Expected outcome**: +``` +Here are the matching tasks in your list: +1. [D][X] return book (by: Sunday) +2. [T][X] borrow book +``` -Expected outcome: +### Exit the program: `bye` -Description of the outcome. +**Format**: `bye` +**Expected outcome**: ``` -expected output +Bye.Have a nice day! ``` + +## FAQ +Q: How do I know if the data are successfully loaded/saved from/into the file? + +A: Duke will display corresponding message and show error message in case the loading/saving process is unsuccessful. + +Q: What if my input format is wrong? + +A: Duke will give hint message and allow users to type in again. + + + From 34ce3a2084adbc01aa80ccdb0af0b493aa01c185 Mon Sep 17 00:00:00 2001 From: Wang Jingwei Date: Mon, 28 Feb 2022 01:09:51 +0800 Subject: [PATCH 21/23] A change in "data.txt". --- data.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data.txt b/data.txt index fa615beb8..ed3f8fb08 100644 --- a/data.txt +++ b/data.txt @@ -1,5 +1,5 @@ T,false,eat food D,true,return book , Sunday -T,false,borrow book +T,true,borrow book E,false,haha , Monday D,false,120 songs , Tomorrow From 06b8da651acadb5a676b49d5e5e07feb6cd17043 Mon Sep 17 00:00:00 2001 From: wwwleah <69473846+Wang-Jingwei@users.noreply.github.com> Date: Mon, 28 Feb 2022 01:15:54 +0800 Subject: [PATCH 22/23] Set theme jekyll-theme-minimal --- docs/_config.yml | 1 + 1 file changed, 1 insertion(+) create mode 100644 docs/_config.yml diff --git a/docs/_config.yml b/docs/_config.yml new file mode 100644 index 000000000..2f7efbeab --- /dev/null +++ b/docs/_config.yml @@ -0,0 +1 @@ +theme: jekyll-theme-minimal \ No newline at end of file From 2d48dd9677b548f68485525f1231f0fc25b17bb1 Mon Sep 17 00:00:00 2001 From: wwwleah <69473846+Wang-Jingwei@users.noreply.github.com> Date: Mon, 28 Feb 2022 01:17:29 +0800 Subject: [PATCH 23/23] Update README.md --- docs/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/README.md b/docs/README.md index a6c1488c9..2ddb75835 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,4 +1,4 @@ -# User Guide for Doke +# User Guide for Duke **Duke** is a Personal Assistant Chatbot that helps a person to keep track of various tasks via a **Command Line Interface**. ## Features