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

[Seth Lee] iP #85

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

[Seth Lee] iP #85

wants to merge 31 commits into from

Conversation

sethlxk
Copy link

@sethlxk sethlxk commented Feb 3, 2022

No description provided.

@@ -1,48 +1,35 @@
import java.lang.reflect.Array;
import java.util.*;
Copy link

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

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

}
}while (!stringInput.equals("bye"));
}while (!userInput.equals("bye"));
Copy link

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

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