Question: Question: Could someone help me finish my Python code for my currrent assignment. It is a two part assignment and I have the first part

Question:

Could someone help me finish my Python code for my currrent assignment. It is a two part assignment and I have the first part done, just need help with the second part of it. For the first part I made a CursorBasedList program. I need to write a simple text-editor program that utilizes my CursorBasedList class. When the text-editor program starts, it should ask for a text-file name (.txt) to edit. If the file name exists, it should load the file into an initially empty CursorBasedList object by reading each line from the file and use the insertAfter method to append the line to the list. Each node in the list will hold a single line of the text file. If the text-file name specified at startup does not exist, an empty CursorBasedList object is created to model editting a new file.

Assignment:

Regardless of whether you loaded a file or just created an empty list, a menu-driven loop very similar to the cursorBasedListTester.py program should allow you to edit the files content by modifying the list. You should NOT need to modify your CursorBasedList class only create a CursorBasedList object and use its methods. Make sure that your editor does not violate any preconditions of the CursorBasedList methods, so your editor is robust, i.e., does not crash when editting. When done editing, the lines of data contained in the nodes of the CursorBasedList are written back to the text file.

Your text-editor program should present a menu of options that allows the user to:

- Navigate and display the first line, i.e., the first line should be the current line

- Navigate and display the last line, i.e., the last line should be the current line

- Navigate and display the next line, i.e., the next line should become the current line. If there is no next line, tell the user and dont change the current line

- Navigate and display the previous line

- Insert a new line before the current line

- Insert a new line after the current line

- Delete the current line and have the line following become the current line. If there is no following line, the current line should be the last line.

- Replace the current line with a new line

- Save the current list back to a text file

Warning: When you load a text file into your list nodes, you can leave the characters on the end of each line of text. However, remember to add a character to end of inserted lines or replacement lines.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!