-
Notifications
You must be signed in to change notification settings - Fork 438
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
[Cao] iP #466
base: master
Are you sure you want to change the base?
[Cao] iP #466
Conversation
Allowed task with deadlines and date/time. Achieved level-4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no violation of the coding standard. You follow the naming layout and comment. But could you try to pack the statement, especially for the output (eg. pack printing output format into a function, so that you can just call that function to print output, instead of using multiple lines to print the lines etc). Also, perhaps adding some comment in each logical block and some Javadoc can provide better documentation.
src/main/java/Deadline.java
Outdated
package main.java; | ||
|
||
public class Deadline extends Task { | ||
protected String deadline; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest using private keyword instead of protected.
src/main/java/Duke.java
Outdated
+ "| | | | | | | |/ / _ \\\n" | ||
+ "| |_| | |_| | < __/\n" | ||
+ "|____/ \\__,_|_|\\_\\___|\n"; | ||
System.out.println("Hello from\n" + logo); | ||
System.out.println(" ____________________________________________________________"); | ||
System.out.println(" Hello! I'm Duke\n What can I do for you?"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
different parts of the code can be grouped together as a method, make it easier for abstraction.
src/main/java/Event.java
Outdated
package main.java; | ||
|
||
public class Event extends Task { | ||
protected String time; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same suggestion as deadline
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some suggestions are made as single comment in each file, overall the code quality is good. Feel free to reply if you have any questions regarding the comments.
src/main/java/CommandHandler.java
Outdated
while (true) { | ||
String command = sc.next(); | ||
switch (command) { | ||
case "bye": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no indention for the case statements. It should be 'aligned' with the switch statement.
src/main/java/CommandHandler.java
Outdated
try { | ||
handleDone(); | ||
} catch (DukeException e) { | ||
System.out.println(" ____________________________________________________________"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you could abstract out this border line as a variable, then call it whenever you need it. Makes the code tidy.
src/main/java/CommandHandler.java
Outdated
public void handleDone() throws DukeException { | ||
String doneCommand = sc.nextLine(); | ||
int index = 0; | ||
if (doneCommand.isEmpty()) { | ||
throw new DukeException("\u2639 OOPS!!! I need to know the index of the task to be done!"); | ||
} | ||
try { | ||
index = Integer.parseInt(doneCommand.stripLeading()); | ||
} catch (NumberFormatException e) { | ||
System.out.println(" ____________________________________________________________"); | ||
System.out.println(" \u2639 Please enter a valid integer!!"); | ||
System.out.println(" ____________________________________________________________\n"); | ||
return; | ||
} | ||
if (index > taskList.size()) { | ||
throw new DukeException("\u2639 Your number is too large!!"); | ||
} | ||
Task currentTask = taskList.get(index - 1); | ||
currentTask.markAsDone(); | ||
System.out.println(" ____________________________________________________________"); | ||
System.out.println(" Nice! I've marked this task as done:"); | ||
System.out.print(" "); | ||
currentTask.printDescription(); | ||
System.out.println(" ____________________________________________________________\n"); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps you could add appropriate line breaks to enhance readability
src/main/java/CommandHandler.java
Outdated
String deleteCommand = sc.nextLine(); | ||
int index = 0; | ||
if (deleteCommand.isEmpty()) { | ||
throw new DukeException("\u2639 OOPS!!! I need to know the index of the task to be deleted!"); | ||
} | ||
try { | ||
index = Integer.parseInt(deleteCommand.stripLeading()); | ||
} catch (NumberFormatException e) { | ||
System.out.println(" ____________________________________________________________"); | ||
System.out.println(" \u2639 Please enter a valid integer!!"); | ||
System.out.println(" ____________________________________________________________\n"); | ||
return; | ||
} | ||
if (index > taskList.size()) { | ||
throw new DukeException("\u2639 Your number is too large!!"); | ||
} | ||
Task currentTask = taskList.get(index - 1); | ||
taskList.remove(index - 1); | ||
System.out.println(" ____________________________________________________________"); | ||
System.out.println(" Noted! I've removed this task:"); | ||
System.out.print(" "); | ||
currentTask.printDescription(); | ||
System.out.println(" Now you have " + taskList.size() + " tasks in the list."); | ||
System.out.println(" ____________________________________________________________\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as above. Line breaks for readability.
* branch-Level-7: solved the bug when the command.txt does not exist. Saved the list of tasks in a txt. file. Every time will load the data from the file.
* branch-Level-8: Stored Deadline data as java.time.LocalDate # Conflicts: # src/main/java/CommandHandler.java # src/main/java/Deadline.java
* branch-GUI: Add FXML Restructure project Finish GUI feature Improve GUI Add some GUI feature Edit build.gradle Revise project structure
Add assertions
* 'master' of https://github.com/Ringo1225/ip: Add assertions
* master: Add assertions
* branch-A-CodeQuality: Improve code quality Add assertions
Improve code quality
* 'master' of https://github.com/Ringo1225/ip: Improve code quality
Add feature: FixedDurationTasks
* 'master' of https://github.com/Ringo1225/ip: Add feature: FixedDurationTasks
* 'master' of https://github.com/Ringo1225/ip: Set theme jekyll-theme-minimal
* 'master' of https://github.com/Ringo1225/ip: Set theme jekyll-theme-midnight
No description provided.