Question: JAVA Primitive Editor (Please help, I am stuck on this assignment which is worth a lot of points. Make sure that the program works because

JAVA Primitive Editor (Please help, I am stuck on this assignment which is worth a lot of points. Make sure that the program works because I had someone answer this incorrectly!) The primary goal of the assignment is to develop a Java based primitive editor. We all know what an editor of a text file is. Notepad, Wordpad, TextWrangler, Pages, and Word are all text editors, where you can type text, correct the text in various places by moving the cursor to the right place and making changes. The biggest advantage with these editors is that you can see the text and visually see the edits you are making. Back in the day, editing was not always visual but command driven instead. [The text files needed to test this out are way too big to be added here. If possible, use a smaller text file to test program out.] One such is a form of editor is a Basic File Editor which will do the following types of edits using suitable methods. Using the methods you wont have any visual way of editing the files. Instead, editing is done via a command which, in turn, is executed by the corresponding method. 1. boolean Find (String x) // Looks for a word "x" in the file and returns true if found or false otherwise. 2. boolean FindReplace (String x, String y) // looks for the first occurrence of word "x" in the file and replaces it with word "y" if found returning true, false otherwise. 
  • Use iterator to step through the list, find position (index) if found and then use set () method
3. boolean FindInsert (String x, String y) // looks for the first occurrence of word "x" in the file and then insert "y" right after "x", if x is found, returning true, false otherwise. 4. boolean Delete (String x) // looks for the first occurrence of word "x" in the file and deletes it from the file, returning true if x is found, returning false otherwise. 5. String spellCheck () // finds the first occurrence of spelling error and returns the misspelled word. If no word is misspelled returns "Spell Check Passed". 6. void spellCheckAll() // find all misspelled words and output them to the screen. 7. void save() // saves file with the changes made. 8. void print() // saves file with the changes and outputs the contents of the file to the screen. 9. void quit() should save() the file and exit. 10. boolean FindReplaceAll (String x, String y) // looks for all occurrences of word "x" in the file and replace each with word "y" if found returning true, false otherwise. ------------- You have learned all the pieces needed to develop the editor. Here are some ideas you want to think about: 1. How do you represent the text file (to be edited) in memory? In other words, what data structure do you want to use that will store the file? 2. Once you store the file in a data structure, you know you can implement the methods that will act on the data structure. 3. Please ensure that the file X to be manipulated is read into memory first and after a few edits may be saved to a file F. Subsequent edits should use file F rather than file X. 4. How do you actually save all the changes? What does it mean to save all the changes made to the file? 5. When you read a formatted text file into memory, make some edits on it, and then save it by writing it back to a different file (name), you may lose the format. And that is ok for this assignment 6. Do a conceptual design first. ALWAYS. Don't jump into coding. What is conceptual design? You should be able to say or write in plain English -- ok this is how I am going to split the problem into various smaller tasks and this is how I am going to do each task. You dont need to submit it necessarily, but I will be happy to review it if you do. 7. Present a menu of choices of all the 10 methods for the user to choose from and number them 1,2,3, ... , 9, 10. If the user types number 2, it means that the user wants to FindReplace(...). For this one, further prompt the user to enter two strings needed for this method to work. And so on. Additionally, you may have a choice for the user to terminate the session, for example, typing "exit" or "done" will cause everything to be saved and terminating the execution of the editor. 8. I want you to think about this and come to class prepared to discuss it. You must use the text files attached to test your code with. 9. For spellcheck, find, findreplace, findinsert,findreplaceall, etc, use the idea in 11 below. 10. You can either output numbers, conjugations or declensions of words, proper nouns, dates etc as spelling errors or ignore them. 11. To get rid of most punctuations, leading and trailing blank spaces, and also for comparing with the dictionary, use String s,t ; s = t.replaceAll("[\\[\\]_:\"'`?;\\0-9;()-/.,*! ]", "").trim().toLowerCase(); 12. You will use the EnglishWordList.txt as the dictionary to compare words in the text file for editing. Both of them will have to be read into memory. (This text file is too large to insert here.) 13. You can read each line of the text file into memory and then split the line into words using the delimiter blank space as below. String[] wordsInLine = line.split(" "); 

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!