[Melissa Lopez] iP - #63
Open
melylopez99 wants to merge 30 commits into
Open
Conversation
HAOYUN49
reviewed
Feb 4, 2020
| public class Duke { | ||
| public static void main(String[] args) { | ||
| String lines = "--------------------------------------------"; | ||
| String logo = " ____ _ \n" |
There was a problem hiding this comment.
Indentation here need to changed into 4 spaces to make indentations consistent in your code
|
|
||
| String line; | ||
| Task[] tasks = new Task[100]; | ||
| int items = 0; |
There was a problem hiding this comment.
Maybe numOfItems or itemCount will be a better choice for the variable name here
| System.out.println((i+1) + ".[" + tasks[i].getStatusIcon() + "] " + tasks[i].description); | ||
| } | ||
| } else if (line.contains("done")) { | ||
| int line_length = line.length(); |
There was a problem hiding this comment.
Variable names must be in camelCase so line_length should be lineLength
Comment on lines
+42
to
+46
| System.out.println(lines); | ||
| Task t = new Task(line); | ||
| System.out.println("added: " + line); | ||
| tasks[items] = t; | ||
| items++; |
|
|
||
|
|
||
|
|
||
| System.out.println(lines); |
| } | ||
|
|
||
| public void markAsDone() { | ||
| this.isDone = true; |
|
|
||
|
|
||
| String line; | ||
| Task[] tasks = new Task[100]; |
There was a problem hiding this comment.
Maybe you can create a new class called TaskManager which helps you manage tasks and do some operations on tasks. And you can declare the array of Task in this new class. It will make your project more constructured
Comment on lines
+24
to
+39
| if (line.equals("bye")) { | ||
| break; | ||
| } else if (line.equals("list")) { | ||
| System.out.println(lines); | ||
| System.out.println("Here are the tasks in your list: "); | ||
| for (int i = 0; i < items; i++) { | ||
| System.out.println((i+1) + ".[" + tasks[i].getStatusIcon() + "] " + tasks[i].description); | ||
| } | ||
| } else if (line.contains("done")) { | ||
| int line_length = line.length(); | ||
| int number = line.charAt(line_length-1) - '0'; | ||
| Task doneTask = tasks[number-1]; | ||
| doneTask.markAsDone(); | ||
| System.out.println("Nice! I've marked this task as done:"); | ||
| System.out.println("[" + doneTask.getStatusIcon() + "] " + doneTask.description); | ||
|
|
There was a problem hiding this comment.
This part is too big. It will be better if it can be divided into several small methods
Merging A-JavaDoc branch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.