[Lik Hern] iP - #488
Conversation
| break; | ||
| case BYE: | ||
| System.out.println("Bye. Hope to see you again soon!"); | ||
| break UserInput; |
TJun-Jie
left a comment
There was a problem hiding this comment.
Great job! However, you can write more javadocs.
| this.at = at; | ||
| } | ||
|
|
||
| @Override |
| return isDone ? "X" : " "; | ||
| } | ||
|
|
||
| public void markAsDone() { |
|
|
||
| @Override | ||
| public String toString() { | ||
| return String.format("[D]%s (by: %s)", super.toString(), by.format(DateTimeFormatter.ofPattern("MMM dd yyyy"))); |
There was a problem hiding this comment.
Line too long, can break line in the middle
| import java.time.format.DateTimeFormatter; | ||
|
|
||
| public class Deadline extends Task { | ||
| protected LocalDate by; |
There was a problem hiding this comment.
Maybe you could name the variable as "deadLineTime" instead of "by"?
| @@ -0,0 +1,18 @@ | |||
| public class Event extends Task { | |||
| protected String at; | |||
There was a problem hiding this comment.
Just like the Deadline class, perhaps you can change the variable name from "at" to "eventTime"?
|
Follows good OO practices, and good naming of variables. Related classes have not been placed in the same folder (package) and more JavaDocs could have been added. |
clarence-chew
left a comment
There was a problem hiding this comment.
Nice work so far, good luck with your iP!
| case DEADLINE: | ||
| scanner.useDelimiter("/by"); | ||
| String deadlineDescription = scanner.next().strip(); | ||
| scanner.reset().skip("/by"); | ||
| String deadlineBy = scanner.nextLine().strip(); | ||
| Deadline deadlineTask = new Deadline(deadlineDescription, deadlineBy); | ||
| storage.add(deadlineTask); | ||
| System.out.println("Got it. I've added this task:\n" + deadlineTask | ||
| + "\nNow you have " + storage.size() + " tasks in the list."); | ||
| break; | ||
| case EVENT: | ||
| scanner.useDelimiter("/at"); | ||
| String eventDescription = scanner.next().strip(); | ||
| scanner.reset().skip("/at"); | ||
| String eventAt = scanner.nextLine().strip(); | ||
| Event eventTask = new Event(eventDescription, eventAt); | ||
| storage.add(eventTask); | ||
| System.out.println("Got it. I've added this task:\n" + eventTask | ||
| + "\nNow you have " + storage.size() + " tasks in the list."); | ||
| break; |
There was a problem hiding this comment.
Code seems to repeat the concept of finding some delimiter, perhaps this can be abstracted?
|
|
||
| protected Task(String description) { | ||
| this.description = description; | ||
| this.isDone = false; |
There was a problem hiding this comment.
Coding standard suggests avoiding unnecessary use of this with fields. (isDone here, in particular.)
https://se-education.org/guides/conventions/java/index.html#variables
# Conflicts: # src/main/java/duke/ui/Ui.java
# Conflicts: # src/main/java/duke/task/Task.java
Include assertions to verify certain assumptions
Do refactor to improve code quality
DukePro
DukePro frees your mind of having to remember things you need to do. It's,
FASTSUPER FAST to useAll you need to do is,
And it is FREE!
Features:
If you are Java programmer, you can use it to practice Java too. Here's the
mainmethod: