Skip to content

[YoengKokLeong] iP#176

Open
YoengKokLeong wants to merge 37 commits into
nus-cs2113-AY2324S2:masterfrom
YoengKokLeong:master
Open

[YoengKokLeong] iP#176
YoengKokLeong wants to merge 37 commits into
nus-cs2113-AY2324S2:masterfrom
YoengKokLeong:master

Conversation

@YoengKokLeong

Copy link
Copy Markdown

Week 4

Comment thread src/main/java/Duke.java
public static void main(String[] args) {
String logo = " ____ _ \n"
public static void addList(String line) {
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.

I feel like using a constant name variable is better in this case so that the entire presentation feels cleaner without all the dashes. Such as using static String BREAK_LINE = "________________________________________________".

Comment thread src/main/java/Duke.java

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Good job on all the naming conventions! :)

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

introStart(); //Prints starting screen

boolean ifExit = false; //exits program if 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.

I think you can consider renaming the boolean variable since the word "ifExit" might not sound like a boolean variable name.

Comment thread src/main/java/Duke.java Outdated
while (!ifExit) {
String line = in.nextLine();
if (line.equals("bye")) {
//checks for bye interaction and sets ifExit to 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.

Good job for writing comments for easier understanding of your codes! :)

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

introStart(); //Prints starting screen

boolean ifExit = false; //exits program if 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.

does not sound like a boolean variable

Comment thread src/main/java/Duke.java
@@ -1,10 +1,85 @@
import java.util.Scanner;
import java.util.Arrays;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

overall good naming. names are self explanatory

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

public static void main(String[] args) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

the code here is very long. could use some commenting to make code easier to read.

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

while (!ifExit) {
String line = in.nextLine();
if (line.equals("bye")) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

conditional statements are clear. not a lot of nested if-else statements

Comment thread src/main/java/Duke.java
import java.util.Scanner;
import java.util.Arrays;

public class Duke {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

indentations LGTM

@Musfirahe0556596 Musfirahe0556596 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.

Looks oki! Just some minor coding standard violation

Comment thread src/main/java/Duke.java Outdated
+ "| |_| | |_| | < __/\n"
+ "|____/ \\__,_|_|\\_\\___|\n";
static boolean ifExit = false; //exits program if true
static Task[] tasks = new Task[100]; //List of tasks

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

just a suggestion: the value 100 can be placed as a named constant so that it's easier for you to change this value (e.g. dh to keep scrolling down the code)

Comment thread src/main/java/Duke.java Outdated
echoTask();
break;
case "event": //add a new event task
tasks[listIndex] = new Event(line.substring(0, eventDividerPositionFrom).trim(), line.substring(eventDividerPositionFrom + 5,eventDividerPositionTo).trim(), line.substring(eventDividerPositionTo + 3).trim());

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Line length should be no longer than 120 chars

Comment thread src/main/java/Duke.java Outdated
echoTask();
break;
case "deadline": //add a new deadline task
tasks[listIndex] = new Deadline(line.substring(0, deadlineDividerPositionBy).trim(), line.substring(deadlineDividerPositionBy + 3).trim());

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Line length should be no longer than 120 chars

Comment thread src/main/java/Duke.java
Comment on lines +25 to +38
{
int printCounter = 1;
if (listIndex == 0) {
throw new IllegalShapeException(); //Throws exception for empty list
}
System.out.println("--------------------------------------");
System.out.println("Here are the tasks in your lists:");
for (Task item : Arrays.copyOf(tasks, listIndex)) {
System.out.print(printCounter + ".");
System.out.println(item);
printCounter++;
}
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.

are these extra brackets? (line 25 and 38)

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.

4 participants