Given a text file, the primary goal of the assignment is to develop a Java based primitive editor. Let me explain what it is first. 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 to these editors is that you can see the text and you can visually see the edits you are making. Back in the day, editing was not always visual and command driven instead.

One such is a form of editor that I call "JB FileEditor" (stands for Java Basic File Editor) which will do the following types of edits given as 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.

  • boolean Find (String x) // Looks for a word "x" in the file and returns true if found or false otherwise.
  • 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.
  • 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.
  • 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.
  • String spellCheck () // finds the first occurrence of spelling error and returns the misspelled word. If no word is misspelled returns "Spell Check Passed".
  • void spellCheckAll() // find all misspelled words and output them to the screen.
  • void save() // saves file with the changes made.
  • void print() // saves file with the changes and outputs the contents of the file to the screen.
  • void quit() should save() the file and exit.
  • 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.
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.