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

[Ng Yong Jie] iP #74

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

Conversation

yongjicode
Copy link

No description provided.

Copy link

@owenl131 owenl131 left a comment

Choose a reason for hiding this comment

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

Would be good to split the code into functions or classes :)


//level 4
// list with 100 rows, 3 columns, 0 - TaskType, 1 - isDone, 2 - TaskName
String[][] TaskList = new String[100][3];
Copy link

Choose a reason for hiding this comment

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

Please avoid using magic literals

}
}
while(true) {
Scanner ScannerObject4 = new Scanner(System.in);
Copy link

Choose a reason for hiding this comment

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

Please start local variables with a lowercase letter

String command = input.substring(0, input.indexOf(' '));
String content = input.substring(input.indexOf(' ') + 1);

boolean isToDo = Objects.equals(command, "todo");
Copy link

Choose a reason for hiding this comment

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

This could be command.equals("todo") instead

continue;
} else if (isUnmark) { //unmark task
int TaskNumber = Integer.parseInt(content);
TaskList[TaskNumber-1][1] = " ";
Copy link

Choose a reason for hiding this comment

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

Please leave spaces on the left and right of operators (like +, -, etc)

Copy link

@mathanmahe mathanmahe left a comment

Choose a reason for hiding this comment

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

Good job, try to update the implementation with the latest requirements as the IP is due soon. There were some coding standard violations and improvements to code quality that I have highlighted and suggested.

}
System.out.println("Bye. Hope to see you again soon!");

// // level 2 & 3

Choose a reason for hiding this comment

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

Delete dead code that is no longer in use.



//level 4
// list with 100 rows, 3 columns, 0 - TaskType, 1 - isDone, 2 - TaskName

Choose a reason for hiding this comment

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

Write comments to the reader, and do not repeat the obvious in comments if it can already be inferred from the code.

Code Quality Guideline: Comment minimally but sufficiently


//level 4
// list with 100 rows, 3 columns, 0 - TaskType, 1 - isDone, 2 - TaskName
String[][] TaskList = new String[100][3];

Choose a reason for hiding this comment

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

Avoid using magic numbers, good to define what these numbers represent as constants like MAX_TASK_LENGTH and MAX_NUMBER_OF_TASKS

Code quality guideline: Avoid magic numbers

}
}
while(true) {
Scanner ScannerObject4 = new Scanner(System.in);

Choose a reason for hiding this comment

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

As per the Java Coding Standard, variable names must be in camelCase.

TaskList[ListCounter][2] = content;
System.out.println("Got it. I've added this task:");
System.out.println("[" + TaskList[ListCounter][0]+"][" + TaskList[ListCounter][1]+"] " + TaskList[ListCounter][2]);
System.out.println("Now you have "+ (ListCounter+1) +" tasks in your list.");

Choose a reason for hiding this comment

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

Avoid long methods, consider breaking down into smaller methods.

Code Quality Guideline: Avoid Long Methods

TaskList[ListCounter][2] = content;
System.out.println("Got it. I've added this task:");
System.out.println("[" + TaskList[ListCounter][0]+"][" + TaskList[ListCounter][1]+"] " + TaskList[ListCounter][2]);
System.out.println("Now you have "+ (ListCounter+1) +" tasks in your list.");

Choose a reason for hiding this comment

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

Ensure that your operators are preceded and followed by whitespaces, as per the Java coding standard.

System.out.println("Got it. I've added this task:");
System.out.println("[" + TaskList[ListCounter][0]+"][" + TaskList[ListCounter][1]+"] " + TaskList[ListCounter][2]);
System.out.println("Now you have "+ (ListCounter+1) +" tasks in your list.");
} else if (isDeadline) { // add deadline to list

Choose a reason for hiding this comment

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

As per the Java Coding Standard, ensure that comments are indented relative to their position in the code.

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.

3 participants