Skip to content

[Melissa Lopez] iP - #63

Open
melylopez99 wants to merge 30 commits into
nus-cs2113-AY1920S2:masterfrom
melylopez99:master
Open

[Melissa Lopez] iP#63
melylopez99 wants to merge 30 commits into
nus-cs2113-AY1920S2:masterfrom
melylopez99:master

Conversation

@melylopez99

Copy link
Copy Markdown

No description provided.

Comment thread src/main/java/Duke.java Outdated
public class Duke {
public static void main(String[] args) {
String lines = "--------------------------------------------";
String logo = " ____ _ \n"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation here need to changed into 4 spaces to make indentations consistent in your code

Comment thread src/main/java/Duke.java Outdated

String line;
Task[] tasks = new Task[100];
int items = 0;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe numOfItems or itemCount will be a better choice for the variable name here

Comment thread src/main/java/Duke.java Outdated
System.out.println((i+1) + ".[" + tasks[i].getStatusIcon() + "] " + tasks[i].description);
}
} else if (line.contains("done")) {
int line_length = line.length();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Variable names must be in camelCase so line_length should be lineLength

Comment thread src/main/java/Duke.java Outdated
Comment on lines +42 to +46
System.out.println(lines);
Task t = new Task(line);
System.out.println("added: " + line);
tasks[items] = t;
items++;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inconsistent indentations here

Comment thread src/main/java/Duke.java Outdated



System.out.println(lines);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inconsistent indentations here

Comment thread src/main/java/Task.java Outdated
}

public void markAsDone() {
this.isDone = true;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inconsistent indentations here

Comment thread src/main/java/Duke.java Outdated


String line;
Task[] tasks = new Task[100];

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 thread src/main/java/Duke.java Outdated
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);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part is too big. It will be better if it can be divided into several small methods

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants