-
Notifications
You must be signed in to change notification settings - Fork 191
Expand file tree
/
Copy pathTask.java
More file actions
41 lines (32 loc) · 928 Bytes
/
Task.java
File metadata and controls
41 lines (32 loc) · 928 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package task;
public class Task {
protected boolean isDone;
protected String description;
private static int totalTasks = 0;
public Task(String description){
this.description = description;
isDone = false;
}
public String getStatusIconAndDescription() {
String icon = (isDone ? "X" : " ");
return addSquareBrackets(icon) + " " + description;
}
public void markAsDone() {
isDone = true;
}
public void setDescription(String description) {
this.description = description;
}
public static int getTotalTasks() {
return totalTasks;
}
public static void setTotalTasks(int totalTasks) {
Task.totalTasks = totalTasks;
}
protected static String addSquareBrackets(String s) {
return "[" + s + "]";
}
protected static String addBrackets(String s) {
return "(" + s + ")";
}
}