diff --git a/src/main/java/Todo.java b/src/main/java/Todo.java deleted file mode 100644 index 5f748f4f..00000000 --- a/src/main/java/Todo.java +++ /dev/null @@ -1,11 +0,0 @@ -class Todo extends Task{ - - Todo(String input) { - super(input); - } - - Todo(String input, boolean isDone) { - super(input); - setDone(isDone); - } -} diff --git a/src/main/java/Duke.java b/src/main/java/duke/Duke.java similarity index 89% rename from src/main/java/Duke.java rename to src/main/java/duke/Duke.java index 509ed277..dea9346c 100644 --- a/src/main/java/Duke.java +++ b/src/main/java/duke/Duke.java @@ -1,10 +1,16 @@ +package duke; + +import duke.ui.UI; +import duke.parser.Parser; +import duke.task.TaskList; + import java.util.Scanner; /** * A Personal Assistant Chatbot that helps a person to keep track of various things. * * @author Wang Zhenquan - * @version Level 3 + * @version Level 5 * @since 20/08/2020 */ diff --git a/src/main/java/DukeException.java b/src/main/java/duke/exception/DukeException.java similarity index 87% rename from src/main/java/DukeException.java rename to src/main/java/duke/exception/DukeException.java index d4d36b8f..c11c3988 100644 --- a/src/main/java/DukeException.java +++ b/src/main/java/duke/exception/DukeException.java @@ -1,3 +1,4 @@ +package duke.exception; /** * Inherits the Exception class.
* Overrides the constructor that takes a String parameter with custom error information
@@ -7,7 +8,7 @@
* Catch that exception somewhere else and print the message inside the exception object.
*/
public class DukeException extends Exception {
- DukeException(String input) {
+ public DukeException(String input) {
super(input);
}
}
\ No newline at end of file
diff --git a/src/main/java/Parser.java b/src/main/java/duke/parser/Parser.java
similarity index 79%
rename from src/main/java/Parser.java
rename to src/main/java/duke/parser/Parser.java
index 302fe0f8..e99d0de4 100644
--- a/src/main/java/Parser.java
+++ b/src/main/java/duke/parser/Parser.java
@@ -1,4 +1,9 @@
-class Parser {
+package duke.parser;
+
+import duke.task.TaskList;
+import duke.ui.UI;
+
+public class Parser {
/**
* @param line The entire user input.
*/
@@ -7,11 +12,11 @@ String getCommandWord(String line) {
}
/**
- * @param line The entire user input.
- * @param ui The UI created in the Duke class.
- * @param tasks The TaskList created in the Duke class.
+ * @param line The entire user input.
+ * @param ui The UI created in the Duke class.
+ * @param tasks The TaskList created in the Duke class.
*/
- boolean parseInput(String line, UI ui, TaskList tasks) {
+ public boolean parseInput(String line, UI ui, TaskList tasks) {
String command = getCommandWord(line);
switch (command) {
diff --git a/src/main/java/Deadline.java b/src/main/java/duke/task/Deadline.java
similarity index 71%
rename from src/main/java/Deadline.java
rename to src/main/java/duke/task/Deadline.java
index 178f7b3c..1ed6b70f 100644
--- a/src/main/java/Deadline.java
+++ b/src/main/java/duke/task/Deadline.java
@@ -1,4 +1,6 @@
-class Deadline extends Todo{
+package duke.task;
+
+class Deadline extends Todo {
private String[] split;
Deadline(String input) {
diff --git a/src/main/java/Event.java b/src/main/java/duke/task/Event.java
similarity index 72%
rename from src/main/java/Event.java
rename to src/main/java/duke/task/Event.java
index 1b30a418..38998b43 100644
--- a/src/main/java/Event.java
+++ b/src/main/java/duke/task/Event.java
@@ -1,4 +1,6 @@
-class Event extends Todo{
+package duke.task;
+
+class Event extends Todo {
private String[] split;
Event(String input) {
diff --git a/src/main/java/Task.java b/src/main/java/duke/task/Task.java
similarity index 71%
rename from src/main/java/Task.java
rename to src/main/java/duke/task/Task.java
index 6f6f47f5..eb75419e 100644
--- a/src/main/java/Task.java
+++ b/src/main/java/duke/task/Task.java
@@ -1,7 +1,10 @@
+package duke.task;
+
/**
- * A class for tasks.
+ * An abstract class that is inherited by the Todo, Deadline and Event classes.
*/
-class Task {
+
+public abstract class Task {
String task;
private boolean isDone;
@@ -20,7 +23,8 @@ boolean getDone() {
String getTaskStatus(Boolean isDone) {
return "[" + (isDone ? "\u2713" : "\u2718") + "] "; //return tick or X symbols
}
- String getDescription() {
+
+ public String getDescription() {
return getTaskStatus(isDone) + task;
}
}
\ No newline at end of file
diff --git a/src/main/java/TaskList.java b/src/main/java/duke/task/TaskList.java
similarity index 90%
rename from src/main/java/TaskList.java
rename to src/main/java/duke/task/TaskList.java
index cbdc0c95..711d99b1 100644
--- a/src/main/java/TaskList.java
+++ b/src/main/java/duke/task/TaskList.java
@@ -1,20 +1,25 @@
+package duke.task;
+
+import duke.exception.DukeException;
+import duke.ui.UI;
+
import java.util.ArrayList;
/**
* Responsible for managing all the tasks in the list. This class will use an ArrayList inside it.
*/
-class TaskList {
+public class TaskList {
private ArrayList