Skip to content

[lckjosh] iP#74

Open
lckjosh wants to merge 37 commits into
nus-cs2113-AY2324S1:masterfrom
lckjosh:master
Open

[lckjosh] iP#74
lckjosh wants to merge 37 commits into
nus-cs2113-AY2324S1:masterfrom
lckjosh:master

Conversation

@lckjosh

@lckjosh lckjosh commented Sep 5, 2023

Copy link
Copy Markdown

No description provided.

Comment thread src/main/java/Duke.java Outdated
switch (command) {
case "list":
if (noOfTasks == 0) {
System.out.println("____________________________________________________________");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Consider using a constant / final variable to represent the line divider

Comment thread src/main/java/Duke.java Outdated
Comment on lines +41 to +46
int taskToMark = Integer.parseInt(parameters) - 1;
tasks[taskToMark].markAsDone();
System.out.println("____________________________________________________________");
System.out.println("I've marked this task as done:");
System.out.println(tasks[taskToMark].getStatusIcon() + " " + tasks[taskToMark].getDescription());
System.out.println("____________________________________________________________");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Consider moving code in cases to another function to reduce verbosity

Comment thread src/main/java/Duke.java Outdated
String parameters = "";
Task[] tasks = new Task[100];
int noOfTasks = 0;
while (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.

May cause an unintended program behaviour, consider setting the loop conditional to while the command is not bye

Comment thread src/main/java/Duke.java Outdated
Comment on lines +59 to +62
System.out.println("____________________________________________________________");
System.out.println("Goodbye, hope to see you again soon!");
System.out.println("____________________________________________________________");
in.close();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Shift this to outside the loop and the condition becomes the loop condition

@irving11119 irving11119 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Your code overall follows the coding standards and naming conventions. The only suggestion I have would to leave blank lines at certain points to separate out logic and make your code more readable.

Comment thread src/main/java/BotBuddy/Duke.java Outdated
Comment on lines +7 to +16
printUnderscores();
System.out.println("Hello from BotBuddy!");
System.out.println("What can I do for you?");
printUnderscores();
Task[] tasks = new Task[100];
String input;
String[] inputArr;
String command = "";
String parameters = "";
Scanner in = new Scanner(System.in);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Perhaps you could leave a blank line between certain lines to seperate related logic (e.g. a blank line after your print statements)

package BotBuddy;

public class BotBuddyException extends Exception {
public BotBuddyException(String s) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Perhaps you could use a more descriptive variable than s such as inputString

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