samuelory iP#173
Conversation
OKW32
left a comment
There was a problem hiding this comment.
Overall good job on following coding standards
| int taskNo; | ||
| while (true) { | ||
| String input = scanner.nextLine(); | ||
| switch (input.split(" ")[0]) { |
There was a problem hiding this comment.
Consider storing the first word of user input in a variable
| switch (input.split(" ")[0]) { | |
| String command = input.split(" ")[0] | |
| switch (command) { |
|
|
||
|
|
||
| Task[] tasks = new Task[100]; | ||
| int numItem = 0; |
There was a problem hiding this comment.
numberOfTasks might have been a better variable name
| @@ -0,0 +1,38 @@ | |||
| public class Task { | |||
There was a problem hiding this comment.
I like that the boolean names sound booleany
| @@ -0,0 +1,60 @@ | |||
| import java.util.Scanner; | |||
There was a problem hiding this comment.
I like that all variable names are declared with camelCase
|
|
||
|
|
||
| Task[] tasks = new Task[100]; | ||
| int numItem = 0; |
| if (this.isDone){ | ||
| return("[X] " + this.taskName); | ||
| } | ||
| else{ |
| int taskNo; | ||
| while (true) { | ||
| String input = scanner.nextLine(); | ||
| switch (input.split(" ")[0]) { |
| System.out.println("Alright, adding this task to the list: "); | ||
| System.out.println(tasks[numItem]); | ||
| numItem++; | ||
| System.out.printf("You have %d tasks in the list.%n", numItem); |
| @@ -0,0 +1,38 @@ | |||
| public class Task { | |||
| protected String taskName; | |||
There was a problem hiding this comment.
unclear variable name: does taskName refer to the description, the type of the task, or the task object itself?
Geinzit
left a comment
There was a problem hiding this comment.
Overall very clean code and very rich features! Good Job!
| @@ -0,0 +1,20 @@ | |||
| public class Event extends Task { | |||
There was a problem hiding this comment.
A better name to reflect the inheritance might be EventTask
| @@ -0,0 +1,17 @@ | |||
| public class Deadline extends Task{ | |||
There was a problem hiding this comment.
A better name to reflect the inheritance relationship might be DeadlineTask
| System.out.println("Alright, adding this task to the list: "); | ||
| System.out.println(tasks[numItem]); | ||
| numItem++; | ||
| System.out.printf("You have %d tasks in the list.%n", numItem); |
There was a problem hiding this comment.
It's best to not repeat yourself, and put these commands into a separate method.
| return taskName; | ||
| } | ||
|
|
||
| public boolean getDone(){ |
There was a problem hiding this comment.
checkIsDone may be a better name to reflect the boolean nature of the variable to get
Joellimjr
left a comment
There was a problem hiding this comment.
Great job so far, but there are still a few improvements to be made
| super(description); | ||
| this.deadlineString = deadline; | ||
| } | ||
| @Override |
There was a problem hiding this comment.
Perhaps you can leave a line between methods for improved readability
| Task[] tasks = new Task[100]; | ||
| int numItem = 0; | ||
| Scanner scanner = new Scanner(System.in); | ||
| int taskNo; |
There was a problem hiding this comment.
perhaps you can name it taskNum to make it more clear
| case ("unmark"): | ||
| taskNo = Integer.parseInt(input.split(" ")[1])-1; | ||
|
|
||
| if (input.split(" ")[0].equals("mark")){ |
There was a problem hiding this comment.
perhaps set your mark case as its own case rather than a fallthrough and processing it within your unmark case. helps with readability as well
|
|
||
|
|
||
| Task[] tasks = new Task[100]; | ||
| int numItem = 0; |
There was a problem hiding this comment.
Could be interpreted as item number or number of items which could be confusing
| @@ -0,0 +1,17 @@ | |||
| public class Deadline extends Task{ | |||
There was a problem hiding this comment.
Comments are missing for the entire code. Good to have them for better readability.
| private final String startTime; | ||
| private final String endTime; |
There was a problem hiding this comment.
Good work with the usage of Access Modifiers.
| return (false); | ||
| case ("list"): | ||
| System.out.println("Here are your tasks for today: "); | ||
| for (int i = 0; i < numItem; i++) { |
There was a problem hiding this comment.
Avoid usage of Magic Numbers and literals.
| printBreakLine(); | ||
| } | ||
|
|
||
| private static boolean handleInput (String input) throws OGFException{ |
There was a problem hiding this comment.
Very long method. Avoid long methods and take corrective action if a method exceeds 30 lines of code.
| printBreakLine(); | ||
| break; | ||
| case ("todo"): | ||
| if (!input.contains(" ") || input.indexOf(" ") == input.length()-1){ |
There was a problem hiding this comment.
This is a complex statement, so try to break it down into two boolean variables which handle each sub-expression.
No description provided.