llo I need help creating " A TO DO LIST" code in java for an interactive test driver . Your interactive test driver loop will allow users to: Add a task. This will require you to capture the subject, priority, and dueDate. Here are some tips on using Java LocalDates. Use now() for the startDate. TaskId should start at 1 and increment each time a task is added. View the next task in the queue using the peek() method and then optionally complete the current task using the poll() method. View a list of all tasks. This will require
Hello I need help creating " A TO DO LIST" code in java for an interactive test driver . Your interactive test driver loop will allow users to:
- Add a task. This will require you to capture the subject, priority, and dueDate. Here are some tips on using Java LocalDates. Use now() for the startDate. TaskId should start at 1 and increment each time a task is added.
- View the next task in the queue using the peek() method and then optionally complete the current task using the poll() method.
- View a list of all tasks. This will require the use of an iterator and the peek() method on each element. Use isEmpty() to check if there are items in your queue and if not, display "No tasks in queue."
- View a single task by id. This will require iterating the task list until the id is found and then displaying it.
- Remove a task by id. This will require you to iterate through the Task queue until you find the task with the matching id. Use remove(task) and confirm to the user that the task has been removed.
Sample Output
Welcome to My Task List
Choose action (Add(a),Next(n),List(l),Detail(d),Edit(e),Remove(r),Quit(q):
a
Adding new Task...
Enter subject:
Square the circle
Enter due date (yyyy-MM-dd):
2020-11-31
Date format exception. Try again.
Enter due date (yyyy-MM-dd):
2020-10-31
Enter priority abbreviation Normal=n,Low=l,High=h,Urgent=u):
l
Choose action (Add(a),Next(n),List(l),Detail(d),Edit(e),Remove(r),Quit(q):
a
Adding new Task...
Enter subject:
Remove the rubble
Enter due date (yyyy-MM-dd):
2020-11-20
Enter priority abbreviation Normal=n,Low=l,High=h,Urgent=u):
n
Choose action (Add(a),Next(n),List(l),Detail(d),Edit(e),Remove(r),Quit(q):
a
Adding new Task...
Enter subject:
Drive the drivers
Enter due date (yyyy-MM-dd):
2020-11-15
Enter priority abbreviation Normal=n,Low=l,High=h,Urgent=u):
h
Choose action (Add(a),Next(n),List(l),Detail(d),Edit(e),Remove(r),Quit(q):
a
Adding new Task...
Enter subject:
Circle the square
Enter due date (yyyy-MM-dd):
2021-11-05
Enter priority abbreviation Normal=n,Low=l,High=h,Urgent=u):
u
Choose action (Add(a),Next(n),List(l),Detail(d),Edit(e),Remove(r),Quit(q):
l
Id:4; Subject: Circle the square; Status: Not Started; Priority: Urgent; StartDate: 2020-10-30; Due date: 2021-11-05
Id:3; Subject: Drive the drivers; Status: Not Started; Priority: High; StartDate: 2020-10-30; Due date: 2020-11-15
Id:2; Subject: Remove the rubble; Status: Not Started; Priority: Normal; StartDate: 2020-10-30; Due date: 2020-11-20
Id:1; Subject: Square the circle; Status: Not Started; Priority: Low; StartDate: 2020-10-30; Due date: 2020-10-31
Choose action (Add(a),Next(n),List(l),Detail(d),Edit(e),Remove(r),Quit(q):
n
Id:4; Subject: Circle the square; Status: Not Started; Priority: Urgent; StartDate: 2020-10-30; Due date: 2021-11-05
Is this task complete? y/n:
y
Choose action (Add(a),Next(n),List(l),Detail(d),Edit(e),Remove(r),Quit(q):
l
Id:3; Subject: Drive the drivers; Status: Not Started; Priority: High; StartDate: 2020-10-30; Due date: 2020-11-15
Id:1; Subject: Square the circle; Status: Not Started; Priority: Low; StartDate: 2020-10-30; Due date: 2020-10-31
Id:2; Subject: Remove the rubble; Status: Not Started; Priority: Normal; StartDate: 2020-10-30; Due date: 2020-11-20
Choose action (Add(a),Next(n),List(l),Detail(d),Edit(e),Remove(r),Quit(q):
e
Enter taskId:
2
TaskId not found...
TaskId not found...
Edit Task:
Enter new subject or press enter to leave unchanged:
Remove the rabble
Enter new due date (yyyy-MM-dd), or press enter to leave unchanged:
Enter status abbreviation Not Started=n,Deferred=d,Waiting=w,Complete=c):
u
Enter priority abbreviation Normal=n,Low=l,High=h,Urgent=u):
l
Choose action (Add(a),Next(n),List(l),Detail(d),Edit(e),Remove(r),Quit(q):
l
Id:3; Subject: Drive the drivers; Status: Not Started; Priority: High; StartDate: 2020-10-30; Due date: 2020-11-15
Id:1; Subject: Square the circle; Status: Not Started; Priority: Low; StartDate: 2020-10-30; Due date: 2020-10-31
Id:2; Subject: Remove the rabble; Status: Not Started; Priority: Low; StartDate: 2020-10-30; Due date: 2020-11-20
Choose action (Add(a),Next(n),List(l),Detail(d),Edit(e),Remove(r),Quit(q):
2
Choose action (Add(a),Next(n),List(l),Detail(d),Edit(e),Remove(r),Quit(q):
e
Enter taskId:
2
TaskId not found...
TaskId not found...
Edit Task:
Enter new subject or press enter to leave unchanged:
Enter new due date (yyyy-MM-dd), or press enter to leave unchanged:
Enter status abbreviation Not Started=n,Deferred=d,Waiting=w,Complete=c):
w
Enter priority abbreviation Normal=n,Low=l,High=h,Urgent=u):
u
Choose action (Add(a),Next(n),List(l),Detail(d),Edit(e),Remove(r),Quit(q):
l
Id:3; Subject: Drive the drivers; Status: Not Started; Priority: High; StartDate: 2020-10-30; Due date: 2020-11-15
Id:1; Subject: Square the circle; Status: Not Started; Priority: Low; StartDate: 2020-10-30; Due date: 2020-10-31
Id:2; Subject: Remove the rabble; Status: Waiting; Priority: Urgent; StartDate: 2020-10-30; Due date: 2020-11-20
Choose action (Add(a),Next(n),List(l),Detail(d),Edit(e),Remove(r),Quit(q):
q
Goodbye
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 3 images