Conversation
Ijaaz01
commented
Feb 6, 2024
- Add Task.java to take care of tasks in list
- Change Duke to Pythia
- Add mood sprites for Pythia
YHWong20
left a comment
There was a problem hiding this comment.
Remember to add spaces between your operators:
https://se-education.org/guides/conventions/java/index.html#layout
src/main/java/Duke.java
Outdated
| import java.util.ArrayList; | ||
| import java.util.List; | ||
| import java.util.Scanner; | ||
| public class Duke { |
There was a problem hiding this comment.
Insert a line break after your import statements.
src/main/java/Duke.java
Outdated
| System.out.println((i+1)+"."+list.get(i).getDoneStatus()+" "+list.get(i).getDescription()); | ||
| } | ||
| } | ||
| public static void main(String[] args) { |
src/main/java/Duke.java
Outdated
| public class Duke { | ||
| public static void printList(List<Task> list) { | ||
| for (int i = 0; i < list.size(); i++) { | ||
| System.out.println((i+1)+"."+list.get(i).getDoneStatus()+" "+list.get(i).getDescription()); |
There was a problem hiding this comment.
Insert spaces between your operators (in this case, insert spaces between your + to separate your operands).
src/main/java/Duke.java
Outdated
| + "| |_| | |_| | < __/\n" | ||
| + "|____/ \\__,_|_|\\_\\___|\n"; | ||
| System.out.println("Hello from\n" + logo); | ||
| String lineBreak = "----------------------------------------------------------"; |
There was a problem hiding this comment.
Your lineBreak, idle and happy Strings should be set as constants. Declare them private final.
src/main/java/Duke.java
Outdated
| String input = "Start"; | ||
| List<Task> list = new ArrayList<>(2); | ||
| Scanner in = new Scanner(System.in); | ||
| System.out.println(idle + "Hello, Im Pythia, how may I help you today?\n"+lineBreak); |
src/main/java/Duke.java
Outdated
| List<Task> list = new ArrayList<>(2); | ||
| Scanner in = new Scanner(System.in); | ||
| System.out.println(idle + "Hello, Im Pythia, how may I help you today?\n"+lineBreak); | ||
| while (!input.equals("bye")) { |
There was a problem hiding this comment.
Add a line break before your while loop.
src/main/java/Duke.java
Outdated
| System.out.println(idle + "Hello, Im Pythia, how may I help you today?\n"+lineBreak); | ||
| while (!input.equals("bye")) { | ||
| input = in.nextLine(); | ||
| if (input.equalsIgnoreCase("list")) { |
There was a problem hiding this comment.
You are not following the K&R brace style for your if-else blocks.
| isDone = false; | ||
| } | ||
|
|
||
| public void doneIsFalse() { |
There was a problem hiding this comment.
Consider renaming your setter methods. Perhaps you could change it to setDoneAsTrue() or something?
src/main/java/Duke.java
Outdated
| else if (input.contains("unmark ")) { | ||
| String[] splitInput = input.split(" "); | ||
| list.get(Integer.parseInt(splitInput[1])-1).doneIsFalse(); | ||
| System.out.println("Unmarked "+ Integer.parseInt(splitInput[1])); |
src/main/java/Duke.java
Outdated
| if (input.equalsIgnoreCase("list")) { | ||
| printList(list); | ||
| } | ||
| else if (input.contains("add ")) { |
There was a problem hiding this comment.
regarding the else if statement, the coding standard should be something like this
if (....) {
xxx;
} else if {
yyyy;
} else {
zzzz;
}
src/main/java/Duke.java
Outdated
| import java.util.ArrayList; | ||
| import java.util.List; | ||
| import java.util.Scanner; | ||
| public class Duke { |
There was a problem hiding this comment.
not compulsory but would be good if you can rename the class according to the name of your chatbot
| public String getDescription() { | ||
| return description; | ||
| } | ||
|
|
There was a problem hiding this comment.
additional line here that can be removed
| @@ -0,0 +1,14 @@ | |||
| public class Deadline extends Task { | |||
There was a problem hiding this comment.
Comments are missing. Good to have them for better readability.
src/main/java/Duke.java
Outdated
| private static MoodSprite mood = new MoodSprite(); | ||
| private static List<Task> list = new ArrayList<>(2); | ||
| private static Parser parser = new Parser(); | ||
| private static final String lineBreak = "----------------------------------------------------------"; |
There was a problem hiding this comment.
Good work with the usage of Access Modifiers.
| super(description); | ||
| this.from = from.replaceFirst("from", "from:"); | ||
| this.to = to.replaceFirst("to", "to:"); | ||
| this.taskId = "[E]"; |
There was a problem hiding this comment.
Avoid the usage of Magic literals.
Add find functionality
Add JavaDoc for UI, Parser and Command classes