Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Melissa Lopez] iP #63

Open
wants to merge 30 commits into
base: master
Choose a base branch
from

Conversation

melylopez99
Copy link

No description provided.

public class Duke {
public static void main(String[] args) {
String lines = "--------------------------------------------";
String logo = " ____ _ \n"
Copy link

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


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

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

System.out.println((i+1) + ".[" + tasks[i].getStatusIcon() + "] " + tasks[i].description);
}
} else if (line.contains("done")) {
int line_length = line.length();
Copy link

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 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

Choose a reason for hiding this comment

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

inconsistent indentations here




System.out.println(lines);
Copy link

Choose a reason for hiding this comment

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

inconsistent indentations here

}

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

Choose a reason for hiding this comment

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

inconsistent indentations here



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

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 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

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