imaginarys96 iP#73
Conversation
| protected boolean isDone; | ||
|
|
||
| public Task(String description) { | ||
| protected String type; |
There was a problem hiding this comment.
type is ambiguous, can be mistaken as a verb, recommend to use taskType
| System.out.println("____________________________________________________________"); | ||
| } else if ( input.startsWith("mark ") ) { | ||
| } else if (input.startsWith("mark ")) { | ||
| String number = input.replace("mark ", "").trim(); |
There was a problem hiding this comment.
number is ambiguous, recommend to use taskNumber
| } else if ( input.startsWith("mark ") ) { | ||
| } else if (input.startsWith("mark ")) { | ||
| String number = input.replace("mark ", "").trim(); | ||
| int markTaskNo = Integer.parseInt(number); |
There was a problem hiding this comment.
noun should not be named with a verb in it, recommend to combine with previous line and use taskNumber as previously mentioned
| if( markTaskNo > 0 ) { | ||
| tasks[markTaskNo-1].markAsDone(); | ||
| if (markTaskNo > 0) { | ||
| tasks[markTaskNo - 1].markAsDone(); |
There was a problem hiding this comment.
using -1 magical number, would be good to define what the -1 means
| } else if ( input.startsWith("unmark ") ) { | ||
| } else if (input.startsWith("unmark ")) { | ||
| String number = input.replace("unmark ", "").trim(); | ||
| int unmarkTaskNo = Integer.parseInt(number); |
There was a problem hiding this comment.
variable name can be mistaken as an action, recommend to use unmarkedTaskNo
| System.out.println( " [" + tasks[unmarkTaskNo-1].getStatusIcon() + "] " + tasks[unmarkTaskNo-1].getDescription() ); | ||
| System.out.println(" [" + tasks[unmarkTaskNo - 1].getStatusIcon() + "] " + tasks[unmarkTaskNo - 1].getDescription()); | ||
| System.out.println("____________________________________________________________"); | ||
| } else if ( input.startsWith("todo") ) { |
There was a problem hiding this comment.
unnecessary spaces for start and ends of brackets
| this.isDone = false; | ||
| } | ||
|
|
||
| public String getTypeIcon() { return type; } |
There was a problem hiding this comment.
curly bracket should start on a newline
Musfirahe0556596
left a comment
There was a problem hiding this comment.
Overall good job but some coding quality and standards to follow!
| @@ -0,0 +1,128 @@ | |||
| package chatbot; | |||
|
|
|||
| import chatbot.*; | |||
There was a problem hiding this comment.
Imported classes should always be listed explicitly (avoid *)
|
|
||
| public class Chatbot { | ||
|
|
||
| public static void main(String[] args) throws Exception { |
There was a problem hiding this comment.
Avoid long methods of more than 30 LoC
| System.out.println("____________________________________________________________"); | ||
| System.out.println(" Here are the tasks in your list:"); | ||
| for (int i = 0; i < numOfTasks; i++) { | ||
| //System.out.println(" " + (i + 1) + ".[" + tasks[i].getTypeIcon() + "][" + tasks[i].getStatusIcon() + "] " + tasks[i].getDescription()); |
| System.out.println(" [" + tasks[unmarkedTaskNo - 1].getStatusIcon() + "] " + tasks[unmarkedTaskNo - 1].getDescription()); | ||
| System.out.println("____________________________________________________________"); | ||
| } else if (input.startsWith("todo")) { | ||
| String msg = input.replace("todo", "").trim(); |
There was a problem hiding this comment.
Avoid foreign language words, slang, and names (msg)
| System.out.println(" Now you have " + String.valueOf(numOfTasks) + " tasks in the list."); | ||
| System.out.println("____________________________________________________________"); | ||
| } else if (input.startsWith("deadline")) { | ||
| String msg = input.replace("deadline", "").trim(); |
There was a problem hiding this comment.
Avoid foreign language words, slang, and names (msg)
| } | ||
|
|
||
| String byDate = msg.substring(msg.indexOf("/by ") + 4).trim(); // will contain the byDate | ||
| String desc = msg.substring(0, msg.indexOf("/by")); // will contain the deadline description |
There was a problem hiding this comment.
Avoid foreign language words, slang, and names (desc)
| System.out.println(" Now you have " + String.valueOf(numOfTasks) + " tasks in the list."); | ||
| System.out.println("____________________________________________________________"); | ||
| } else if (input.startsWith("event")) { | ||
| String msg = input.replace("event", "").trim(); |
There was a problem hiding this comment.
Avoid foreign language words, slang, and names (msg)
| String dateRange = msg.substring(msg.indexOf("/from ") + 6).trim(); | ||
| String fromDate = dateRange.substring(0, dateRange.indexOf("/to ")).trim(); | ||
| String toDate = dateRange.substring(dateRange.indexOf("/to ") + 4).trim(); | ||
| String desc = msg.substring(0, msg.indexOf("/from ")); // will contain the deadline description |
There was a problem hiding this comment.
Avoid foreign language words, slang, and names (desc)
text-ui-test/runtest.bat|sh scripts generate a file ACTUAL.TXT. However, .gitignore uses ACTUAL.txt, which means the generated file will not be ignored by Git on non-Windows OS. Let's update .gitignore as ACTUAL.txt -> ACTUAL.TXT
No description provided.