Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 t?o:

- 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

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

Database Systems For Advanced Applications 27th International Conference Dasfaa 2022 Virtual Event April 11 14 2022 Proceedings Part 2 Lncs 13246

Authors: Arnab Bhattacharya ,Janice Lee Mong Li ,Divyakant Agrawal ,P. Krishna Reddy ,Mukesh Mohania ,Anirban Mondal ,Vikram Goyal ,Rage Uday Kiran

1st Edition

ISBN: 3031001257, 978-3031001253

More Books

Students also viewed these Databases questions

Question

Discuss the 3Rs.

Answered: 1 week ago

Question

Describe the patterns of business communication.

Answered: 1 week ago

Question

3. Provide two explanations for the effects of mass media

Answered: 1 week ago