Question

JAVA Primitive Editor (Please help, I am stuck on this assignment which is worth a lot...

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 won’t 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 don’t 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(" ");  
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Primitive types are the most basic data types available within the Java language.

There are 8: boolean, byte, char, short, int, long, float and double. These types serve as the building blocks of data manipulation in Java. Such types serve only one purpose — containing pure, simple values of a kind. Because these data types are defined into the Java type system by default, they come with a number of operations predefined. You can not define a new operation for such primitive types. In the Java type system, there are three further categories of primitives:

Let's discuss what are actually prefer to some primitives type. Before start this first take an simple example.

Integer primitive type silent overflow.

int i = Integer.MAX_VALUE;
System.out.println(i);
i = i + 1;
System.out.println(i);
System.out.println(Integer.MIN_VALUE);

All the primitive types have a fixed size. Thus, the primitive types are limited to a range of values. A smaller primitive type (byte) can contain less values than a bigger one (long).

As Java is strongly typed, you can't assign a floating point number (a number with a decimal point) to an integer variable:

int age;
age = 10.5;

Hope These Article May be help you. Thank You.

Add a comment
Know the answer?
Add Answer to:
JAVA Primitive Editor (Please help, I am stuck on this assignment which is worth a lot...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • JAVA Primitive Editor The primary goal of the assignment is to develop a Java based primitive...

    JAVA Primitive Editor 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...

  • In this lab you will write a spell check program. The program has two input files:...

    In this lab you will write a spell check program. The program has two input files: one is the dictionary (a list of valid words) and the other is the document to be spellchecked. The program will read in the words for the dictionary, then will read the document and check whether each word is found in the dictionary. If not, the user will be prompted to leave the word as is or type in a replacement word and add...

  • I've previously completed a Java assignment where I wrote a program that reads a given text...

    I've previously completed a Java assignment where I wrote a program that reads a given text file and creates an index that stores the line numbers for where individual words occur. I've been given a new assignment where I need to modify some of my old code. I need to replace the indexer in my Index class with a NavigableMap<String, Word> and update my Word class with NavigableSet<Integer> lines. The instantiated objects should be TreeMap() and TreeSet(). I have below...

  • Topics: About Java What is a compiler, and what does it do? Characteristics of the languageStrongly...

    Topics: About Java What is a compiler, and what does it do? Characteristics of the languageStrongly typed and statically typed Everything has a data type & data types must be declared Case sensitive Object oriented System.out.print() vs. System.out.println() How to use the Scanner class to obtain user input Data typesWhat are they? Know the basic types like: int, double, boolean, String, etc. Variables What is a variable? Declarations Initialization Assignment Constants Reserved words like: What is a reserved word? Examples:...

  • Dictionary.java DictionaryInterface.java Spell.java SpellCheck.java In this lab you will write a spell check program. The program...

    Dictionary.java DictionaryInterface.java Spell.java SpellCheck.java In this lab you will write a spell check program. The program has two input files: one is the dictionary (a list of valid words) and the other is the input file to be spell checked. The program will read in the words for the dictionary, then will read the input file and check whether each word is found in the dictionary. If not, the user will be prompted to leave the word as is, add...

  • CSC110 Lab 6 (ALL CODING IN JAVA) Problem: A text file contains a paragraph. You are to read the contents of the file, store the UNIQUEwords and count the occurrences of each unique word. When the fil...

    CSC110 Lab 6 (ALL CODING IN JAVA) Problem: A text file contains a paragraph. You are to read the contents of the file, store the UNIQUEwords and count the occurrences of each unique word. When the file is completely read, write the words and the number of occurrences to a text file. The output should be the words in ALPHABETICAL order along with the number of times they occur and the number of syllables. Then write the following statistics to...

  • In java, write a program with a recursive method which asks the user for a text...

    In java, write a program with a recursive method which asks the user for a text file (verifying that the text file exists and is readable) and opens the file and for each word in the file determines if the word only contains characters and determines if the word is alpha opposite. Now what I mean by alpha opposite is that each letter is the word is opposite from the other letter in the alphabet. For example take the word...

  • could you please help me with this problem, also I need a little text so I...

    could you please help me with this problem, also I need a little text so I can understand how you solved the problem? import java.io.File; import java.util.Scanner; /** * This program lists the files in a directory specified by * the user. The user is asked to type in a directory name. * If the name entered by the user is not a directory, a * message is printed and the program ends. */ public class DirectoryList { public static...

  • Python Help Please! This is a problem that I have been stuck on.I am only suppose...

    Python Help Please! This is a problem that I have been stuck on.I am only suppose to use the basic python coding principles, including for loops, if statements, elif statements, lists, counters, functions, nested statements, .read, .write, while, local variables or global variables, etc. Thank you! I am using python 3.4.1. ***( The bottom photo is a continuation of the first one)**** Problem statement For this program, you are to design and implement text search engine, similar to the one...

  • Written in Java I have an error in the accountFormCheck block can i get help to...

    Written in Java I have an error in the accountFormCheck block can i get help to fix it please. Java code is below. I keep getting an exception error when debugging it as well Collector.java package userCreation; import java.io.IOException; import java.net.URL; import java.util.ResourceBundle; import java.util.regex.Matcher; import java.util.regex.Pattern; import javafx.event.ActionEvent; import javafx.fxml.*; import javafx.scene.*; import javafx.scene.control.*; import javafx.scene.text.Text; import javafx.stage.*; public class Controller implements Initializable{ @FXML private PasswordField Password_text; @FXML private PasswordField Confirm_text; @FXML private TextField FirstName_text; @FXML private TextField LastName_text;...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT