You are going to write two classes that will work together to represent a to-do
ID: 3567648 • Letter: Y
Question
You are going to write two classes that will work together to represent a to-do list. This is the first part, and we will write the first class and test it.
a) Create a class TodoItem that represents an item on a to do list. It should be able to store the following information in its instance variables:
You need to decide the best way to represent and store the above information.
b) Write getters and setters for your instance variables in TodoItem. The setters should only set the instance variables to valid values. If the value passed to the setter is not valid (for example, if the priority of an item is represented by a number between 1 and 5, and the number 6 is passed to the setter), then the setter should print an error message and the program should exit.
c) Write a toString() method for TodoItem.
d) Make TodoItem implement the Comparable interface. To do this, you will need to write the method compareTo, which should compare two TodoItems based on their due date and priority. You can decide exactly how the comparison is made (i.e. whether the due date or the priority is more important), but document the choice in your code.
e) Write a driver to test the above code. To test the compareTo method, create three different arrays of TodoItems and sort them usingArrays.sort(...)
Explanation / Answer
No more stress http://superiorwriters247.org/ is there to do the assignments for you
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.