Skip to content

Commit 242ac9b

Browse files
author
chloesyy
committed
Change [Y] and [N] symbols to ticks and crosses when marking a task as done. Add lines in between user's commands to make it less messy.
1 parent ebee317 commit 242ac9b

3 files changed

Lines changed: 26 additions & 22 deletions

File tree

duke.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
[T] | 0 | nothing
1+
22
[D] | 0 | nothing | today
33
[E] | 1 | nothing | today
44

5+
6+

src/main/java/duke/Duke.java

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public static void loadFileTask(String line) {
8686

8787
public static void printWelcomeMessage() {
8888
System.out.println("Welcome! :D This is TaskThomas.");
89-
System.out.println("What are you doing today?");
89+
System.out.println("What are you doing today? \n");
9090
}
9191

9292
public static void printExitMessage() {
@@ -112,7 +112,7 @@ public static void handleLine(String line) {
112112
*/
113113
public static void printList() {
114114
if (tasks.size() == 0) {
115-
System.out.println("Oops! You have no tasks in your list.");
115+
System.out.println("Oops! You have no tasks in your list. \n");
116116
return;
117117
}
118118

@@ -121,6 +121,7 @@ public static void printList() {
121121
System.out.print(tasks.indexOf(task)+1 + ".");
122122
task.printTask();
123123
}
124+
System.out.println();
124125
}
125126

126127
/*
@@ -131,10 +132,10 @@ public static void markAsDone(String line) {
131132
try {
132133
taskNum = Integer.parseInt(line.substring(5));
133134
} catch (NumberFormatException e) {
134-
System.out.println("Ohno! Please list a task number to be marked done :(");
135+
System.out.println("Ohno! Please list a task number to be marked done :( \n");
135136
return;
136137
} catch (StringIndexOutOfBoundsException e) {
137-
System.out.println("Ohno! You didn't list the task number :(");
138+
System.out.println("Ohno! You didn't list the task number :( \n");
138139
return;
139140
}
140141

@@ -149,11 +150,12 @@ public static void markAsDone(String line) {
149150
// Prints output message
150151
System.out.println("Good job! You've completed:");
151152
task.printTask();
153+
System.out.println();
152154
} catch (IndexOutOfBoundsException e) {
153-
System.out.println("Ohno! This is an invalid task number :(");
155+
System.out.println("Ohno! This is an invalid task number :( \n");
154156
return;
155157
} catch (IOException e) {
156-
System.out.println("Something went wrong: " + e.getMessage());
158+
System.out.println("Something went wrong: " + e.getMessage() + "\n");
157159
}
158160
}
159161

@@ -165,10 +167,10 @@ public static void deleteTask(String line) {
165167
try {
166168
taskNum = Integer.parseInt(line.substring(7));
167169
} catch (NumberFormatException e) {
168-
System.out.println("Ohno! Please list a task number to be marked done :(");
170+
System.out.println("Ohno! Please list a task number to be marked done :( \n");
169171
return;
170172
} catch (StringIndexOutOfBoundsException e) {
171-
System.out.println("Ohno! You didn't list the task number :(");
173+
System.out.println("Ohno! You didn't list the task number :( \n");
172174
return;
173175
}
174176

@@ -183,12 +185,12 @@ public static void deleteTask(String line) {
183185
// Print output message
184186
System.out.println("Alright lazy bum... I'll delete this:");
185187
task.printTask();
186-
System.out.println("Now you have " + tasks.size() + " tasks in the list!");
188+
System.out.println("Now you have " + tasks.size() + " tasks in the list! \n");
187189
} catch (IndexOutOfBoundsException e) {
188-
System.out.println("Ohno! This is an invalid task number :(");
190+
System.out.println("Ohno! This is an invalid task number :( \n");
189191
return;
190192
} catch (IOException e) {
191-
System.out.println("Something went wrong: " + e.getMessage());
193+
System.out.println("Something went wrong: " + e.getMessage() + "\n");
192194
return;
193195
}
194196
}
@@ -201,38 +203,38 @@ public static void addTask(String line) {
201203
try {
202204
addTodo(line.substring(5), false);
203205
} catch (StringIndexOutOfBoundsException e) {
204-
System.out.println("Ohno! The todo description cannot be empty :(");
206+
System.out.println("Ohno! The todo description cannot be empty :( \n");
205207
return;
206208
}
207209
} else if (line.startsWith("deadline")) {
208210
try {
209211
addDeadline(line.substring(9), false);
210212
} catch (StringIndexOutOfBoundsException e) {
211-
System.out.println("Ohno! The deadline needs a description and a /by :(");
213+
System.out.println("Ohno! The deadline needs a description and a /by :( \n");
212214
return;
213215
} catch (ArrayIndexOutOfBoundsException e) {
214-
System.out.println("Ohno! Your deadline needs a /by :(");
216+
System.out.println("Ohno! Your deadline needs a /by :( \n");
215217
return;
216218
}
217219
} else if (line.startsWith("event")) {
218220
try {
219221
addEvent(line.substring(6), false);
220222
} catch (StringIndexOutOfBoundsException e) {
221-
System.out.println("Ohno! The event needs a description and an /at :(");
223+
System.out.println("Ohno! The event needs a description and an /at :( \n");
222224
return;
223225
} catch (ArrayIndexOutOfBoundsException e) {
224-
System.out.println("Ohno! Your event needs an /at :(");
226+
System.out.println("Ohno! Your event needs an /at :( \n");
225227
return;
226228
}
227229
} else {
228230
// Happens if the task is not labeled
229-
System.out.println("Ohno! You should label your task with 'todo', 'deadline', or 'event'...");
231+
System.out.println("Ohno! You should label your task with 'todo', 'deadline', or 'event'... \n");
230232
return;
231233
}
232234

233235
System.out.println("Okay! I added:");
234236
tasks.get(tasks.size()-1).printTask();
235-
System.out.println("Now you have " + tasks.size() + " tasks in the list!");
237+
System.out.println("Now you have " + tasks.size() + " tasks in the list! \n");
236238
}
237239

238240

@@ -281,7 +283,7 @@ public static void writeToFile(String filePath, String line) {
281283
writer.write(System.lineSeparator() + line);
282284
writer.close();
283285
} catch (IOException e) {
284-
System.out.println("Something went wrong: " + e.getMessage());
286+
System.out.println("Something went wrong: " + e.getMessage() + "\n");
285287
}
286288
}
287289

src/main/java/duke/task/Task.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ public Task(String description) {
1111
}
1212

1313
public String getStatusIcon() {
14-
// Return Y or N symbols
15-
return (isDone ? "[Y]" : "[N]");
14+
// Return tick or cross symbols
15+
return (isDone ? "[\u2713]" : "[\u2718]");
1616
}
1717

1818
public abstract String getDescriptor();

0 commit comments

Comments
 (0)