Skip to content

Commit

Permalink
Fix output messages
Browse files Browse the repository at this point in the history
zognin committed Sep 14, 2021
1 parent 3c48de1 commit 71103e3
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/main/java/command/AddCommand.java
Original file line number Diff line number Diff line change
@@ -83,7 +83,7 @@ private Message getOutputMessage(TaskList list, Task task) {

int numOfTasks = list.getNumberOfTasks();
String taskWord = numOfTasks == 1 ? "task" : "tasks";
String suffix = String.format("Now you have %d %s in the list", list.getNumberOfTasks(), taskWord);
String suffix = String.format("Now you have %d %s in the entire list", list.getNumberOfTasks(), taskWord);

return new Message(prefix, task.toString(), suffix);
}
2 changes: 1 addition & 1 deletion src/main/java/command/DeleteCommand.java
Original file line number Diff line number Diff line change
@@ -57,7 +57,7 @@ private Message getOutputMessage(TaskList list, Task task) {

int numOfTasks = list.getNumberOfTasks();
String taskWord = numOfTasks == 1 ? "task" : "tasks";
String suffix = String.format("Now you have %d %s in the list", list.getNumberOfTasks(), taskWord);
String suffix = String.format("Now you have %d %s in the entire list", list.getNumberOfTasks(), taskWord);

return new Message(prefix, task.toString(), suffix);
}
2 changes: 1 addition & 1 deletion src/main/java/exception/InvalidCommandFormatException.java
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ public class InvalidCommandFormatException extends DukeException {
public InvalidCommandFormatException(CommandTypeEnum commandType) {
super(
String.format(
"A %s command should have be in this format: %s",
"A %s command should be in this format: %s",
commandType.toString(),
commandType.getFormat()
)
4 changes: 2 additions & 2 deletions src/main/java/exception/InvalidDateTimeException.java
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ public class InvalidDateTimeException extends DukeException {
*
* @param format Required datetime format.
*/
public InvalidDateTimeException(String format) {
super(String.format("Date/time should be in the form of <%s>", format));
public InvalidDateTimeException(String dateOrTime, String format) {
super(String.format("%s should be in the form of <%s>", dateOrTime, format));
}
}
4 changes: 2 additions & 2 deletions src/main/java/parser/DateTimeParser.java
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@ public static LocalDate changeDateStringToDate(String dateString, String dateFor
try {
return LocalDate.parse(dateString, dateFormatter);
} catch (DateTimeParseException e) {
throw new InvalidDateTimeException(dateFormat);
throw new InvalidDateTimeException("Date", dateFormat);
}
}

@@ -45,7 +45,7 @@ public static LocalTime changeTimeStringToTime(String timeString, String timeFor
try {
return LocalTime.parse(timeString, timeFormatter);
} catch (DateTimeParseException e) {
throw new InvalidDateTimeException(timeFormat);
throw new InvalidDateTimeException("Time", timeFormat);
}
}

0 comments on commit 71103e3

Please sign in to comment.