Starting from:

$25

Using the SinglyLinkedList classes built in class

Using the SinglyLinkedList classes built in class, make the proper modifications to make it a
DoublyLinkedList. Then, write a simple text editor. Keep the entire text in a doubly linked list, storing each line in a separate node. The program begin with a line number as a prompt to enter text. From there, you have the following choices:
• Enter the letter I and a string S: this will insert the string S at the end
• Enter the letters IA, a line number N, and string S1: inserts S1 after line N
• Enter the letters IB, a line number N, and string S1: inserts S1 before line N
• Enter the letter D with a number N: deletes the Nth line of text
• Enter the letter L with a number N: lists the Nth line of text
• Enter the letters LA: lists all lines of text
• Enter the letter Q: quits the program
To support each of these operations, you will have the following methods in your DoublyLinkedList class:
• insert: this method will take the line of text as a string and add it to the end of the list.
• insertAfter: this method takes an integer parameter (used to indicate a line number) and a string parameter, and inserts the text after the appropriate node.
• insertBefore: this method takes an integer parameter (used to indicate a line number) and a string parameter, and inserts the text before the appropriate node
• deleteByPosition: this method will take a integer parameter indicating which element should be deleted. For example, if 3 is passed in, the 3rd element should be deleted.
• printNode: this method takes an integer parameter of the node to print. For example, if 3 is passed in, it will print the 3rd node.
• printAllNodes: this method takes no parameters and prints all nodes in the list.
You MUST use this to begin your project. The starting project includes:
• Assign04Driver.java: A driver class which provides all the interaction with the user. This should not be modified.
• Node.java: A node class for a singly linked list. This will need to be modified to support a doubly linked list.
• DoublyLinkedList.java: A starter class for your doubly linked list. It includes method stubs which you must implement
• TextEditor.java: An interface that DoublyLinkedList.java implements. You must not change this interface, nor can you remove the implementation of this interface from
DoublyLinkedList.java.

More products