[Thomas Cherian] iP#274
Conversation
Rename Duke to Pac
Add enum Keyword
| @@ -0,0 +1,17 @@ | |||
| public class Deadline extends Task{ | |||
| private final String dateTime; | |||
There was a problem hiding this comment.
Var declares as final may need to be in all capital letters, eg: DATE_TIME
| @@ -0,0 +1,17 @@ | |||
| public class Event extends Task { | |||
| private final String dateTime; | |||
| String input = sc.nextLine(); | ||
| try { | ||
| String[] inputArray = input.split(" ", 2); | ||
| String firstword = inputArray[0].toLowerCase(); |
| default: | ||
| keyword = Keyword.ERROR; | ||
| break; | ||
| } |
There was a problem hiding this comment.
can consider using a hashmap to lookup the right Keyword given a string? same functionality but may save some lines, may look slightly more readable as well, but it's up to you
| break; | ||
| case ERROR: | ||
| throw new PacException("I don't know what this means"); | ||
| } |
There was a problem hiding this comment.
can consider rewriting these lines of code into separate functions to avoid deep nesting
manu2002g
left a comment
There was a problem hiding this comment.
I noticed that there aren't any JavaDoc comments and maybe you should consider adding them to make your code easier to understand.
But overall great code quality that is quite readable! :)
| static String logo = " ____ ___ _____\n" | ||
| + "| _ \\ / _ \\ | ___|\n" | ||
| + "| |_| | | |_| | | |\n" | ||
| + "| __/ | | | | | |___\n" | ||
| + "|_| |_| |_| |_____|\n"; | ||
| static String newline = "----------------------------------------------------"; |
There was a problem hiding this comment.
Should the logo and newline variables be made final? And their names changed to fit the coding standard for naming constants eg: LOGO
| String firstword = inputArray[0].toLowerCase(); | ||
| Keyword keyword; | ||
|
|
||
| switch (firstword) { |
There was a problem hiding this comment.
The coding standard says that we shouldn't indent the case statements under switch I think it's possible to configure IntelliJ to follow this by default.
| break; | ||
| } | ||
|
|
||
| switch (keyword) { |
There was a problem hiding this comment.
The case statements here should also not be intended
| String[] inputArray = input.split("/"); | ||
| inputArray[1] = inputArray[1].replaceFirst("BY ", "by "); | ||
| inputArray[1] = inputArray[1].replaceFirst("By ", "by "); | ||
| inputArray[1] = inputArray[1].replaceFirst("bY ", "by "); | ||
| inputArray[1] = inputArray[1].split("by ", 2)[1]; | ||
| if (inputArray[1].isBlank()) { | ||
| throw new PacException("Please enter a valid date or time."); | ||
| } | ||
| Task task = new Deadline(inputArray[0], inputArray[1]); | ||
| tasks.add(task); | ||
| System.out.println(newline + "\nadded: " + task.toString()); | ||
| System.out.println("You have " + tasks.size() + " tasks in your list" + "\n" + newline + "\n"); |
There was a problem hiding this comment.
Maybe you can add a few blank lines in this code block to make it more readable? The coding standard suggest that "Logical units within a block should be separated by one blank line." Perhaps you could add blank lines to separate the code into sections dealing with formatting, processing and output.
Add data/ to .gitignore
# Conflicts: # src/main/java/Pac.java
No description provided.