Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

here is the zip file http://www.cs.uni.edu/~fienup/cs1520s19/homework/hw3.zip Word Pro -hw3.lwp 1/2 To start the homework: Download and extract the file hw3.zip from The hw3.zip file contains:

here is the zip file http://www.cs.uni.edu/~fienup/cs1520s19/homework/hw3.zip

image text in transcribedimage text in transcribedimage text in transcribed

Word Pro -hw3.lwp 1/2 To start the homework: Download and extract the file hw3.zip from The hw3.zip file contains: the Node class (in the node.py module) and the Node2Way class (in the node2way-py module) the skeleton CursorBasedList class (in the cursor based list.py module) which you will complete the cursorBasedListTester.py file that you can use to interactively test your CursorBasedist class. Part A: Recall that in a cursor-hase list a cursor (indicating the current item) can he moved around the list with the cursor being used to identify the region of the list to be manipulated. We will insert and removing items relative to the current item. A current item must always he defined as long as the list is not e rations Description of operation L.getCurrent() L.hasNext () L.next() Precondition: the list is not empty. Returns the current item without removing it or changing the current Precondition: the ist is not empty. Retums True if the current item has a next item; otherwise return False Precondition: hasNext returns True. Postcondition: The current item has moved nght one item Precondition: the list is not empty. Returns True if the current item has a asPrevious( T.-previous) Precondition: hasPrevious retums True. Postcondition: The current item has moved left one item Precondition: the list is not empty, Makes the first item the current item. .1asto L.insertAfteritem) Inserts item after the current item, or as the only item if the list is empty. The Makes the last item the current item. new item is the current item. insert etore(item) Inserts item hefore the current item, or as the only item if the list is empty. The ncw itcm is the current itcm .replace (newValue Precondition: the list is not L.remove) the current item by the new Value. Precondition: the list is not empty. Removes and returns the current item Making the next item the current item if one exists; otherwise the tail item in the list is the current item unless the list in now The cursor_based list.py file contains a skeleton CursorBasedList class. You MUST uses a doubly-linked list implementation with a header node and a trailer node. All "real list items will be inserted between the header and trailer nodes to reduce the number of "special cases (e.g., inserting first iem in an empty list, deleting the last item from the list, etc.). An empty doubly-linked list implementation with a header node and a trailer nude looks like: Header Node" Trailer Node ous data next previous data next trailer Word Pro -hw3.hwp 2/2 Data Structures (CS 1520) PART B: Once you have your CursorBasedList class finished, you are to write a simple text-cditor program that utilizes your CursorBasedList class. When your text-editor program starts, it should ask for a text-file name (.txt) toedit. 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. I the text-file name specified at startup does not exist, an empty CursorBasedList object is created to model editing a new file. Homework #3 Due: March 2 (Saturday) at 11:59 PM Regardless of whether you loaded a file or just created an empty list, a menu-driven loop very similar to the cursorBasedList Tester.py program should allow you to edit the file's content by modifying the list. You should NOT need to modity your Cur sorBasedList class only create a Cur sorBasedList object and use its methods. Make sure that your editor does not violate any preconditions of the CursorBasedList methods, so your editor is robust, .e., does not crash when editing. When done editing, the lines of data contained in the nodes of the CursorBased.ist 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.c, the first line should be the current line navigate and display the last line. ie., the last line should be the current line navigate and display the next line, i.e., the next line should become the current line. tell the user and don't change the current line navigate and display the previous line. Similarly, if there is no previous line, tell the user and don't change the current line. insert a new line before the current line * If there is no next 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 "n" characters on the end of each line of text. However, remember to add a 'n' character to end of inserted lines or replacement lines, Implement AND fully test your text-editor program. Part of your grade will be determined by how robust your text-editor runs (i.e., does not crash) and how user-friendintuitive your program is to use. You are required Word Pro -hw3.lwp 2/2 PARTB: Once you have your CursorRasedL.ist class finished, you are to write a simple text-editor program that utilizes your Cur sorBasedList class. When your 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 editing a ne file. Regardless of whether you loaded a file or just created an empty list, a menu-driven loop very similar to the cursorBasedtistTester.py program should allow you to edit the file's content by modifyingthe . You should NOT need to modify your CursorBasedList class only create a CursorBasedList object and use its mcthods. Make sure that your editor docs not violate any preconditions of the CursorBasedList methods so your editor is robust, i.e., does not crash when editing. 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.., lhe firs! line should be the current line navigate and display the last line, .e., the last line should he the current line navigate and display the next line, ie.the next line should become the current line. If there is no next line. * tell the user and don't change the current line navigate and display the previous line. Similarly, if there is no previous line, tell the user and don't change the current line. insert a new line hefore the current line . insert a new linc after the current line . delete the current line and have the line following become the cr lne. 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 hack to a text file Warning: When you load a text file into your list nodes, you can leave the n' characters on the end of each line of text. However, remember to add a n character to end of inserted lines or replacement lines. Implement AND fully test your text-editor program. Part of your grade will be determined by how robust your text-editor runs (i.e., does not crash) and how user-friend intuitive your prograrn is to use. You are required to submit a brief User's manual on how to use your text-editor For extra credit, your program may provide do one or more of the following additional text-editor functionality Find word and Find next occurance Replace a specified word/string on the current line by another word/string Copy and Paste a line, etc. . Word Pro -hw3.lwp 1/2 To start the homework: Download and extract the file hw3.zip from The hw3.zip file contains: the Node class (in the node.py module) and the Node2Way class (in the node2way-py module) the skeleton CursorBasedList class (in the cursor based list.py module) which you will complete the cursorBasedListTester.py file that you can use to interactively test your CursorBasedist class. Part A: Recall that in a cursor-hase list a cursor (indicating the current item) can he moved around the list with the cursor being used to identify the region of the list to be manipulated. We will insert and removing items relative to the current item. A current item must always he defined as long as the list is not e rations Description of operation L.getCurrent() L.hasNext () L.next() Precondition: the list is not empty. Returns the current item without removing it or changing the current Precondition: the ist is not empty. Retums True if the current item has a next item; otherwise return False Precondition: hasNext returns True. Postcondition: The current item has moved nght one item Precondition: the list is not empty. Returns True if the current item has a asPrevious( T.-previous) Precondition: hasPrevious retums True. Postcondition: The current item has moved left one item Precondition: the list is not empty, Makes the first item the current item. .1asto L.insertAfteritem) Inserts item after the current item, or as the only item if the list is empty. The Makes the last item the current item. new item is the current item. insert etore(item) Inserts item hefore the current item, or as the only item if the list is empty. The ncw itcm is the current itcm .replace (newValue Precondition: the list is not L.remove) the current item by the new Value. Precondition: the list is not empty. Removes and returns the current item Making the next item the current item if one exists; otherwise the tail item in the list is the current item unless the list in now The cursor_based list.py file contains a skeleton CursorBasedList class. You MUST uses a doubly-linked list implementation with a header node and a trailer node. All "real list items will be inserted between the header and trailer nodes to reduce the number of "special cases (e.g., inserting first iem in an empty list, deleting the last item from the list, etc.). An empty doubly-linked list implementation with a header node and a trailer nude looks like: Header Node" Trailer Node ous data next previous data next trailer Word Pro -hw3.hwp 2/2 Data Structures (CS 1520) PART B: Once you have your CursorBasedList class finished, you are to write a simple text-cditor program that utilizes your CursorBasedList class. When your text-editor program starts, it should ask for a text-file name (.txt) toedit. 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. I the text-file name specified at startup does not exist, an empty CursorBasedList object is created to model editing a new file. Homework #3 Due: March 2 (Saturday) at 11:59 PM Regardless of whether you loaded a file or just created an empty list, a menu-driven loop very similar to the cursorBasedList Tester.py program should allow you to edit the file's content by modifying the list. You should NOT need to modity your Cur sorBasedList class only create a Cur sorBasedList object and use its methods. Make sure that your editor does not violate any preconditions of the CursorBasedList methods, so your editor is robust, .e., does not crash when editing. When done editing, the lines of data contained in the nodes of the CursorBased.ist 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.c, the first line should be the current line navigate and display the last line. ie., the last line should be the current line navigate and display the next line, i.e., the next line should become the current line. tell the user and don't change the current line navigate and display the previous line. Similarly, if there is no previous line, tell the user and don't change the current line. insert a new line before the current line * If there is no next 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 "n" characters on the end of each line of text. However, remember to add a 'n' character to end of inserted lines or replacement lines, Implement AND fully test your text-editor program. Part of your grade will be determined by how robust your text-editor runs (i.e., does not crash) and how user-friendintuitive your program is to use. You are required Word Pro -hw3.lwp 2/2 PARTB: Once you have your CursorRasedL.ist class finished, you are to write a simple text-editor program that utilizes your Cur sorBasedList class. When your 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 editing a ne file. Regardless of whether you loaded a file or just created an empty list, a menu-driven loop very similar to the cursorBasedtistTester.py program should allow you to edit the file's content by modifyingthe . You should NOT need to modify your CursorBasedList class only create a CursorBasedList object and use its mcthods. Make sure that your editor docs not violate any preconditions of the CursorBasedList methods so your editor is robust, i.e., does not crash when editing. 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.., lhe firs! line should be the current line navigate and display the last line, .e., the last line should he the current line navigate and display the next line, ie.the next line should become the current line. If there is no next line. * tell the user and don't change the current line navigate and display the previous line. Similarly, if there is no previous line, tell the user and don't change the current line. insert a new line hefore the current line . insert a new linc after the current line . delete the current line and have the line following become the cr lne. 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 hack to a text file Warning: When you load a text file into your list nodes, you can leave the n' characters on the end of each line of text. However, remember to add a n character to end of inserted lines or replacement lines. Implement AND fully test your text-editor program. Part of your grade will be determined by how robust your text-editor runs (i.e., does not crash) and how user-friend intuitive your prograrn is to use. You are required to submit a brief User's manual on how to use your text-editor For extra credit, your program may provide do one or more of the following additional text-editor functionality Find word and Find next occurance Replace a specified word/string on the current line by another word/string Copy and Paste a line, etc

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

The Database Relational Model A Retrospective Review And Analysis

Authors: C. J. Date

1st Edition

0201612941, 978-0201612943

More Books

Students also viewed these Databases questions

Question

5. How would you describe your typical day at work?

Answered: 1 week ago

Question

7. What qualities do you see as necessary for your line of work?

Answered: 1 week ago