Skip to content

[Seth Lee] iP - #85

Open
sethlxk wants to merge 31 commits into
nus-cs2113-AY2122S2:masterfrom
sethlxk:master
Open

sethlxk wants to merge 31 commits into
nus-cs2113-AY2122S2:masterfrom
sethlxk:master

Conversation

@sethlxk

@sethlxk sethlxk commented Feb 3, 2022

Copy link
Copy Markdown

No description provided.

Comment thread src/main/java/Duke.java Outdated
@@ -1,48 +1,35 @@
import java.lang.reflect.Array;
import java.util.*;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hi, pls try not to use "import java.util.*". According to the coding standard, imported classes should always be listed explicitly.

Comment thread src/main/java/Duke.java Outdated
Comment on lines +14 to +27
} else if (userInput.equals("list")) {
displayList(taskArray);
} else if (userInput.contains("unmark")) {
unmarkTask(taskArray, userInput);
displayUnmarkedTask(taskArray, userInput);
} else if (userInput.contains("mark")){
markTask(taskArray, userInput);
displayMarkedTask(taskArray, userInput);
} else if (userInput.contains("deadline")){
addDeadline(taskArray, userInput);
displayTask(taskArray);
} else if (userInput.contains("event")){
addEvent(taskArray, userInput);
displayTask(taskArray);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

clean and neat, very organised :)

Comment thread src/main/java/Duke.java Outdated
displayTask(taskArray);
}
}while (!stringInput.equals("bye"));
}while (!userInput.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.

good to have a space before "while"

Comment thread src/main/java/Duke.java Outdated
Comment on lines +93 to +120
public static void addTodo(ArrayList<Task> taskArray, String userInput){
String[] temp = new String[100];
temp = userInput.split(" ");
String description = temp[1];
Todo todo = new Todo(description);
addTask(taskArray,todo);
}
public static void displayTask(ArrayList<Task> taskArray){
System.out.println("Gotcha. Here's what you have to do");
System.out.println(taskArray.get(taskArray.size()-1).toString());
System.out.println("There are " + taskArray.size() + " tasks in the list");
}
public static void addDeadline(ArrayList<Task> taskArray, String userInput){
String[] temp = new String[100];
temp = userInput.split("/by");
String description = temp[0].split("deadline")[1].trim();
String by = temp[1].trim();
Deadline deadline = new Deadline(description, by);
addTask(taskArray,deadline);
}
public static void addEvent(ArrayList<Task> taskArray, String userInput){
String[] temp = new String[100];
temp = userInput.split("/at");
String description = temp[0].split("event")[1].trim();
String at = temp[1].trim();
Event event = new Event(description, at);
addTask(taskArray,event);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nice! naming and structure are very consistent.

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