[Wang Silang] iP#214
Conversation
| System.out.println("Sir, your task has been unmarked as requested."); | ||
| } | ||
|
|
||
| public static void printCurrentList(Task[] list, int numOfItems) |
There was a problem hiding this comment.
nice job making clear method and variable names!
| } | ||
|
|
||
| public static void addList() | ||
| { |
There was a problem hiding this comment.
Use K&R style brackets (as done in the exitLine method)
| if(line.startsWith("todo")){ | ||
| newTask = new ToDos(line); | ||
| } | ||
| else if(line.startsWith("deadline")){ |
There was a problem hiding this comment.
change the form of the if/else statements to match the coding standard:
if (condition) {
statements;
} else if (condition) {
statements;
} else {
statements;
}
There was a problem hiding this comment.
Yeah, you can refer to this link [https://se-education.org/guides/conventions/java/basic.html] for if-else statement coding standards.
| @@ -1,3 +1,8 @@ | |||
| import jdk.jfr.Event; | |||
| if(line.startsWith("todo")){ | ||
| newTask = new ToDos(line); | ||
| } | ||
| else if(line.startsWith("deadline")){ |
There was a problem hiding this comment.
Yeah, you can refer to this link [https://se-education.org/guides/conventions/java/basic.html] for if-else statement coding standards.
| { | ||
| String line; | ||
| Scanner in = new Scanner(System.in); | ||
| line = in.nextLine(); | ||
| while(!line.equals("bye")) { | ||
| System.out.println(line); | ||
| line = in.nextLine(); | ||
| } | ||
| } |
There was a problem hiding this comment.
You'd want to indent the { } properly, like:
public static void echo(){
// your code
}
| @@ -0,0 +1,31 @@ | |||
| public class Task { | |||
| protected String taskLabel; | |||
There was a problem hiding this comment.
I like how you have added another variable called taskLabel.
This is actually clear while storing the data in it instead of explicitly typing [D] / [E] / [T] every time while printing the lists.
Zemdalk
left a comment
There was a problem hiding this comment.
Your indentation is really good. StringBuffer class is really useful, I like the way you use it to deal with strings. Maybe you can replace some "magic numbers" with constants to make your code more readable? Just some personal ideas.
| private String endTime; | ||
| private String taskLabel = "[D]"; | ||
| public Deadlines (String input){ | ||
| super(input.substring(9,input.indexOf('/') - 1)); // Sanitize input by removing "deadline" at the start |
There was a problem hiding this comment.
Personally, maybe you can replace the number 9 with a constant to avoid "magic numbers"?
Like
private static final int DEADLINE_LABEL = 9;?
There was a problem hiding this comment.
Agreed. Thanks for the idea!
| super.setTaskLabel(taskLabel); | ||
| endTime = "(" + getEndTime(input) + ")"; | ||
| } | ||
| // Method of StringBuffer operation taken from |
There was a problem hiding this comment.
I like the way you use StringBuffer to operate on these strings, it's really useful.
wamikamalik
left a comment
There was a problem hiding this comment.
Great Job! A few nits here and there. Do take a look at my comments below.
| public static void echo() { | ||
| String line; | ||
| Scanner in = new Scanner(System.in); | ||
| line = in.nextLine(); | ||
| while (!line.equals("bye")) { | ||
| System.out.println(line); | ||
| line = in.nextLine(); | ||
| } | ||
| } |
There was a problem hiding this comment.
You can remove methods that are not being used to reduce redundant code and improve readability.
| } | ||
| line = in.nextLine(); // read in next line of text | ||
| } | ||
| } |
There was a problem hiding this comment.
Try to have less that 30 LOC for any method. You can split the contents of this method into multiple methods.
| System.out.println("Glad I could be of help!"); | ||
| } | ||
|
|
||
| public static void addList() { |
There was a problem hiding this comment.
Do remember to provide appropriate names to methods. The method below is not just adding a list or adding to a list.
| } | ||
| return output; | ||
| } | ||
| } |
| @@ -0,0 +1,4 @@ | |||
| package Duke.Exception; | |||
There was a problem hiding this comment.
Names representing packages should be in all lower case. Look at Java coding standards for more details.
branch-level-7
branch-A-JavaDoc
* tag 'branch-Level-9': branch-Level-9
JAR released
* master: branch-A-JavaDoc # Conflicts: # src/main/java/Duke/Ui.java
branch-level-9
No description provided.