Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need this is Dr Java. Help? Lab 02 To Do List Objective: Implement a system that keeps tracks of tasks you have to do!

I need this is Dr Java. Help? image text in transcribed
image text in transcribed
Lab 02 To Do List Objective: Implement a system that keeps tracks of tasks you have to do! Write a class ToDoList with the following Internal class ListNode which has o Instance Variables . data of type String link of type ListNode o Constructors . Default Parameterized Instance Variables o head: a ListNode which always points to the beginning of the linked list o current: a ListNode which moves to point at different items in the list o previous: a ListNode which points to the item behind current. . Constructor o A default constructor that initializes head to an empty ListNode and sets current and previous to point at the head. Methods o goToNext: This moves the current node forward in the list by one node. It doesn't move forward if that node is null o gotoPrev: This moves the current node backwards in the list by one node. It does not move backwards if the current node is the head. o getDataAtCurrent: returns the data at the current node as long as the current isn't null o setDataAtCurrent: takes in a parameter of type String and sets the data at the current node to that value as long as current is not null o addItem: This method adds a new node at the end of the list (HINT: Look for first null element using a loop). If the list is empty (thus head is null) then it starts the list. o insertAfterCurrent: creates a new node based on data that is passed in by a parameter and puts that node after the current position o deleteCurrentNode: removes the current node from the list by resetting the links o showList: prints out the contents of the list line-by-line Finally write a driver that implements an instance of GrocerList and demonstrates each of the methods work

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Management Databases And Organizations

Authors: Richard T. Watson

3rd Edition

0471418455, 978-0471418450

More Books

Students also viewed these Databases questions

Question

Explain in detail how the Mughal Empire was established in India

Answered: 1 week ago