Conversation
exits when the user types 'bye'.
…y them back to the user when requested
YEOWEIHNGWHYELAB
left a comment
There was a problem hiding this comment.
LGTM! There are minor code quality issues that can be fixed easily.
src/main/java/Duke.java
Outdated
| Scanner in = new Scanner(System.in); | ||
| while ( byeFlag != 1 ) { | ||
| while (byeFlag != 1) { | ||
| System.out.println("____________________________________________________________\n"); |
There was a problem hiding this comment.
Suggestion:
Make a variable for printing underscore.
src/main/java/Duke.java
Outdated
| // checkCommands() is a method that allows us to determine when the user says bye. | ||
| private static void checkCommands(String line) { | ||
| if ( positionCheck >= 100 ) { | ||
| if (positionCheck >= 100) { |
There was a problem hiding this comment.
Suggestion:
Reduce the use of magic numbers.
src/main/java/Duke.java
Outdated
| if ( positionCheck == 0 ) { | ||
| if (positionCheck == 0) { | ||
| System.out.println("There is no data to show master!"); | ||
| } else { |
There was a problem hiding this comment.
Suggestion:
Avoid deep nesting.
src/main/java/Duke.java
Outdated
| private static Task[] commands = new Task[100]; | ||
|
|
||
| // sendCommands() is a method used to allow the user to send his/her commands to C3PO | ||
| private static void sendCommands() { |
There was a problem hiding this comment.
could be changed to sayCommand as there is only 1 command
src/main/java/Duke.java
Outdated
| } | ||
|
|
||
| // checkCommands() is a method that allows us to determine when the user says bye. | ||
| private static void checkCommands(String line) { |
There was a problem hiding this comment.
Similarly for this could be checkCommand
src/main/java/Duke.java
Outdated
| sendCommands(); | ||
| sayBye(); | ||
| } | ||
| } |
There was a problem hiding this comment.
Overall, good naming conventions used 💯
src/main/java/Duke.java
Outdated
| return; | ||
| } | ||
| } | ||
| System.out.println("Sorry Master! I don't think you have properly keyed in the parameters. Please enter the task, followed by \"/by\",\n" + |
There was a problem hiding this comment.
Could be split into 2 println statements to improve readability
YEOWEIHNGWHYELAB
left a comment
There was a problem hiding this comment.
LGTM! Just make some minor changes.
src/main/java/Duke.java
Outdated
| } | ||
| } else if (line.equals("done")){ | ||
| System.out.println("Oh no master, I am not quite sure which task you would like me to mark as done"); | ||
| } else if (line.contains("done")){ |
There was a problem hiding this comment.
Suggestion:
Could transfer these into another class.
src/main/java/Duke.java
Outdated
| @@ -31,11 +31,19 @@ private static void checkCommands(String line) { | |||
| } else { | |||
There was a problem hiding this comment.
Suggestion: Avoid deep nesting.
src/main/java/Duke.java
Outdated
| String line; | ||
| Scanner in = new Scanner(System.in); | ||
| while ( byeFlag != 1 ) { | ||
| System.out.println("____________________________________________________________\n"); |
There was a problem hiding this comment.
Suggestion:
Make a variable for printing underscore.
src/main/java/Duke.java
Outdated
| // checkCommands() is a method that allows us to determine when the user says bye. | ||
| private static void checkCommands(String line) { | ||
| if ( positionCheck >= 100 ) { | ||
| if (positionCheck >= 100) { |
There was a problem hiding this comment.
Suggestion:
Reduce the use of magic numbers.
src/main/java/Duke.java
Outdated
| "followed by the due date to specify the deadline Master!"); | ||
| } | ||
|
|
||
| public static void addEvent(String[] input, int length) { |
There was a problem hiding this comment.
Try to use single level abstraction.
Branch a java doc
Levels-0-3 and A-CodingStandard have been added