ToDoItem is a class that represents a task that needs to be done. * A ToDoItem h
ID: 3639986 • Letter: T
Question
ToDoItem is a class that represents a task that needs to be done.* A ToDoItem has a description, priority, category and dueDate. These instance variables are described in more detail below.
Description and category should be of type String. The description should never be empty and it should probably be fairly short for display purposes. You should provide a String constant, UNFILED or NONE perhaps, to be applied to ToDoItem objects that haven't been given a category. Can you write a do items that has a description, and category?
Explanation / Answer
class TodoItem {
final CONST String UNIFILED="unfiled";
private String description="";
private String category;
public TodoItem(String category, String description) {
this.description=description;
this.category=category;
if(this.category!=null && this.category.length==0) {
this.category=UNFILED;
}
}
}