Conversation
…display them back to the user when requested
…ility to change the status back to not done, and Task class
…ility to change the status back to not done, and Task class
jiajun2002
left a comment
There was a problem hiding this comment.
The code is short and concise! Nice to read :) I made some minor notes regarding naming and using constants!
src/main/java/Volkov.java
Outdated
| public static String formatResponse(String msg) { | ||
| return " ____________________________________________________________\n" | ||
| + msg + "\n" | ||
| + " ____________________________________________________________\n"; | ||
| } |
There was a problem hiding this comment.
I like that you have a function for formatting the code! Perhaps consider adding a string constant for the linebreak instead of manually typing out "_______________" each time
src/main/java/Volkov.java
Outdated
| String msg = " Got it. I've added this task:\n" | ||
| + " " + t.toString() + "\n" | ||
| + " Now you have " + storeTaskIndex + " tasks in the list."; | ||
| return formatResponse(msg); |
There was a problem hiding this comment.
You can consider storing the " " spaces in a string as well! Could save some time so you don't have to manually type out the spaces, and also minimises the risk of typing an incorrect number of spaces
src/main/java/Volkov.java
Outdated
| String endDate = input.substring(indexOfEndDate + 4); | ||
| Event t = new Event(taskDesc, startDate, endDate); | ||
| System.out.println(formatTaskMsg(t)); | ||
|
|
There was a problem hiding this comment.
I like the way you name your variables! They are very clear :)
src/main/java/Volkov.java
Outdated
|
|
||
| } else if (input.equals("list")) { | ||
| StringBuilder sb = new StringBuilder(); | ||
| boolean first = true; |
There was a problem hiding this comment.
Perhaps renaming the boolean to isFirst would be clearer?
There was a problem hiding this comment.
I like that the code complies with the Java Coding Standard.
There was a problem hiding this comment.
I would recommend including getters and setters methods in the Task class.
src/main/java/Volkov.java
Outdated
| int indexOfDeadline = input.indexOf(" /by"); | ||
| String taskDesc = input.substring(9, indexOfDeadline); | ||
| String deadline = input.substring(indexOfDeadline + 4); | ||
| Deadline t = new Deadline(taskDesc, deadline); |
There was a problem hiding this comment.
You should assign a meaningful name to the deadline and event Tasks instead of 't'.
src/main/java/Volkov.java
Outdated
| System.out.println(formatResponse(sb.toString())); | ||
|
|
||
| } else if (input.startsWith("mark")) { | ||
| int taskNo = Integer.parseInt(input.substring(5)) - 1; |
There was a problem hiding this comment.
Perhaps 'taskNumber' would be a clearer variable name than 'taskNo'?
# Conflicts: # src/main/java/Volkov.java
src/main/java/Volkov.java
Outdated
| StringBuilder sb = new StringBuilder(); | ||
| sb.append(" Here are the tasks in your list:"); | ||
| for (int i = 0; i < listOfTasks.size(); i++) { | ||
| sb.append("\n ").append(i + 1).append(".").append(listOfTasks.get(i)); |
There was a problem hiding this comment.
Avoid usage of magic strings and numbers
src/main/java/Volkov.java
Outdated
| if (taskDesc.trim().isEmpty()) { | ||
| throw new MissingDescription("MISSING DESCRIPTION, reenter with description"); | ||
| } | ||
| Todo t = new Todo(taskDesc); |
There was a problem hiding this comment.
You might want to name "t" to a more intuitive name so that it increases readability.
…nd Commands classes
Level-8 Date and Times
Level-9 Added find feature
# Conflicts: # src/main/java/Task.java
No description provided.