Find Us On: Facebook Twitter Rss Feed Blog
Need To Register? Sign Up Login

Java - HashableWord

prabhsun
prabhsun 


You will be creating a program that does a simple Spell check and GRE word check. You will be storing the dictionaries in hash tables implemented with buckets/chaining. Data Element - HashableWord You will be creating a class HashableWord which implements HashableWordInterface. The hashCode method should return an integer based on the following hash function: final int HASH_MULTIPLIER = 31; int h = 0; for (int i = 0; i < word.length(); i++) h = HASH_MULTIPLIER * h + s.charAt(i) Data Structure - HashTable You will be implementing a class HashTable which implements HashTableInterface with buckets. You can use an array of linked lists(of HashableWordInterfaces). You will need a method to add to the hashtable and other methods you think are necessary. Data Managers – Dictonary & DictionaryUtility Create a class Dictionary that implements the DictionaryInterface that has the methods: checkWord, checkWords, create, add and printToFile. This class will use an object of your HashTable class to hold the words for the Dictionary. Create a class DictionaryUtility that implements the DictionaryUtilityInterface that has methods checkGRE for one sentence or an ArrayList of Sentences. This class will use an object of your HashTable class to hold the words for the DictionaryUtility (GRE words). GUI Driver Create two Dictionaries, one for Common words and one for GRE words. Use the FileChooser to ask the user for the location of the Common Words Dictionary File and the GRE Dictionary File before the initial screen appears. If the user selects the Read Text File button, use the FileChooser to ask the user for the location of the text file to be read and then display the contents of the file in the text area. If the user selects the Spell Check button and the program finds words that are not in the Common Words Dictionary, it will list the word as not in the dictionary and will ask the user if they want to add these words to the dictionary. The JTextArea can also be used for entering text by the user. For simplicity, put each sentence on a different line. If the user selects the GRE button, the program will check to make sure that each sentence has a word from the GRE dictionary. If sentences don’t contain a GRE word, the user will be shown all those sentences. When the user selects Exit, the common words dictionary is stored with any new words that the user has requested to be added to the dictionary. Some Suggestions: 1. Convert to uppercase (or lowercase) before inserting words in the dictionary files, and then convert words in the text area to uppercase (or lowercase) to compare. 2. To extract words using next, you might consider using the method .useDelimiter(“[^A-Za-z]+”); it extracts when it starts with an alpha and continues to extract while there is an alpha. 3. If sentences are on separate lines, you can use .nextLine 4. When extracting from a text file and building a string to set the text of the JTextArea, don’t forget to put “\n” at the end of all lines. User choses the files for the Spell check (common words) and the Gre word check Attachments Tags Clarifications

Answers

java dictionary

uetian_cute
uetian_cute 



if you have any further query please message me. Attachments
assignment4.zip (322 K) Download












Preview
HREF="../../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Class assignment4.Assignment4"; } } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <!-- ========= START OF TOP NAVBAR ======= --> <A NAME="navbar_top"><!-- --></A> <A HREF="#skip-navbar_top" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CEL

Preview
========= END OF TOP NAVBAR ========= --> <HR> <CENTER> <H2> <B>Uses of Class<br>assignment4.Dictionary</B></H2> </CENTER> <A NAME="assignment4"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> Uses of <A HREF="../../assignment4/Dictionary.html" title="class in assignment4">Dictionary</A> in <A HREF="../../assignment4/package-summary.html">assignment4</A></FONT><

Preview
<A HREF="../../overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B><

Preview
contains a gre word</TD> </TR> </TABLE> &nbsp; <P> <HR> <!-- ======= START OF BOTTOM NAVBAR ====== --> <A NAME="navbar_bottom"><!-- --></A> <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_bottom_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEE

Preview
NAVBAR ====== --> <A NAME="navbar_bottom"><!-- --></A> <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_bottom_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../assignment4/package-summary.html"><FONT CLASS=

Preview
document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <!-- ========= END OF TOP NAVBAR ========= --> <HR> <CENTER> <H2> <B>Uses of Interface<br>assignment4.DictionaryUtilityInterface</B></H2> </CENTER> <A NAME="assignment4"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" S

Preview
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../assignment4/HashTable.html" title="class in assignment4"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list

Preview
} } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <!-- ========= START OF TOP NAVBAR ======= --> <A NAME="navbar_top"><!-- --></A> <A HREF="#skip-navbar_top" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center

Preview
VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../index.html?assignment4//class-useHashableWord.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="HashableWord.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../allclasses-nof

Preview
<A HREF="../../assignment4/package-summary.html">assignment4</A> that implement <A HREF="../../assignment4/HashableWordInterface.html" title="interface in assignment4">HashableWordInterface</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;class</CODE></FONT></TD> <TD><CODE><B><A HREF="../../assignment4/HashableWord.html" title="class in assignment4">HashableWord</A></B></CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nb

Preview
HREF="class-use/Assignment4.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>

Preview
http-equiv="Content-Type" content="text/html; charset=UTF-8"> <TITLE> Dictionary </TITLE> <META NAME="date" CONTENT="2013-03-21"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Dictionary"; } } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <!-- ========= START OF TOP NAVBAR

Preview
wait, wait</CODE></TD> </TR> </TABLE> &nbsp;<A NAME="methods_inherited_from_class_java.awt.MenuContainer"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left"><B>Methods inherited from interface java.awt.MenuContainer</B></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE>getFont, postEvent</CODE></TD> </TR> </TABLE> &nbsp; <P> <!-- ========= CONSTRUCTOR DETAIL ======== --> <A N

Preview
CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../assignment4/package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/DictionaryInterface.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" C

Preview
HREF="../assignment4/DictionaryInterface.html" title="interface in assignment4">DictionaryInterface</A>&nbsp;d)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;returns an array of Strings which are sentences that don't contain a gre word</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;boolean</CODE></FONT></TD> <TD><CODE><B><A HREF="../assignment4/DictionaryUtility.html#checkGRE(java.lang.String

Preview
a gre word</TD> </TR> </TABLE> &nbsp; <P> <!-- ============ METHOD DETAIL ========== --> <A NAME="method_detail"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> <B>Method Detail</B></FONT></TH> </TR> </TABLE> <A NAME="checkGRE(java.util.ArrayList, assignment4.DictionaryInterface)"><!-- --></A><H3> checkGRE</H3> <PRE> java.util.ArrayList&lt;java.lang.String&gt;

Preview
word, and creates its own hash method and equals method. <P> <P> <HR> <P> <!-- ======== CONSTRUCTOR SUMMARY ======== --> <A NAME="constructor_summary"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Constructor Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><B><A HREF="../assignment4/HashableWord.html#HashableWord(java.

Preview
in class <CODE>java.lang.Object</CODE></DL> </DD> <DD><DL> <DT><B>Returns:</B><DD>hash code</DL> </DD> </DL> <HR> <A NAME="equals(assignment4.HashableWordInterface)"><!-- --></A><H3> equals</H3> <PRE> boolean <B>equals</B>(<A HREF="../assignment4/HashableWordInterface.html" title="interface in assignment4">HashableWordInterface</A>&nbsp;s)</PRE> <DL> <DD>Compares a String portion of a HashableWord to a String portion of another HashableWord <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>s</CODE

Preview
sorted ArrayList</TD> </TR> </TABLE> &nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD> </TR> </TABLE> &nbsp; <P

Preview
--></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../assignment4/package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/HashTableInterface.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT

Preview
21 06:39:41 MST 2013 --> <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> <TITLE> assignment4 </TITLE> <META NAME="date" CONTENT="2013-03-21"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../stylesheet.css" TITLE="Style"> </HEAD> <BODY BGCOLOR="white"> <FONT size="+1" CLASS="FrameTitleFont"> <A HREF="../assignment4/package-summary.html" target="classFrame">assignment4</A></FONT> <TABLE BORDER="0" WIDTH="100%" SUMMARY=""> <TR> <TD NOWRAP><FONT size="+1" CLASS="FrameHeadin

Preview
type="text/javascript"> function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="assignment4"; } } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <!-- ========= START OF TOP NAVBAR ======= --> <A NAME="navbar_top"><!-- --></A> <A HREF="#skip-navbar_top" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF"

Preview
Hierarchy </TITLE> <META NAME="date" CONTENT="2013-03-21"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="assignment4 Class Hierarchy"; } } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <!-- ========= START OF TOP NAVBAR ======= --> <A NAME="navbar_top"><!-- --></A> <A HREF=

Preview
SIZE="-2"> &nbsp;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../index.html?assignment4/package-use.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="package-use.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../allclasses-noframe.html"><B>All Cla

Preview

Preview
HREF="../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <!-- ========= END OF TOP NAVBAR ========= --> <A HREF="index-1.html">A</A> <A HREF="index-2.html">C</A> <A HREF="index-3.html">D</A> <A HREF="index-4.html">E</A> <A HREF="index-5.html">G</A> <A HREF="index-6.html">H</A> <A HREF="index-7.html">M</A> <A HREF="index-8.html">P

Preview
word is in the dictionary <DT><A HREF="../assignment4/Dictionary.html#checkWords(java.util.ArrayList)"><B>checkWords(ArrayList&lt;String&gt;)</B></A> - Method in class assignment4.<A HREF="../assignment4/Dictionary.html" title="class in assignment4">Dictionary</A> <DD>check if words in an ArrayList are in the dictionary <DT><A HREF="../assignment4/DictionaryInterface.html#checkWords(java.util.ArrayList)"><B>checkWords(ArrayList&lt;String&gt;)</B></A> - Method in interface assignment4.<A HREF="

Preview
HREF="index-8.html">P</A> <A HREF="index-9.html">R</A> <A HREF="index-10.html">S</A> <HR> <A NAME="_D_"><!-- --></A><H2> <B>D</B></H2> <DL> <DT><A HREF="../assignment4/Dictionary.html" title="class in assignment4"><B>Dictionary</B></A> - Class in <A HREF="../assignment4/package-summary.html">assignment4</A><DD>Creates a HashTable containing a dictionary from a file.<DT><A HREF="../assignment4/Dictionary.html#Dictionary()"><B>Dictionary()</B></A> - Constructor for class assignment4.<A HREF="../a

Preview
links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_bottom_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../assignment4/package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="Nav

Preview
HREF="../overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Index</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <

Preview
SIZE="-2"> <A HREF="../index.html?index-filesindex-6.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="index-6.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <!-- ========= END O

Preview
CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Index</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSP

Preview
<A HREF="../assignment4/package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Use</FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../deprecated-li

Preview
WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../assignment4/package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT>&nbsp;</TD>

Preview
== -1) { parent.document.title="S-Index"; } } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <!-- ========= START OF TOP NAVBAR ======= --> <A NAME="navbar_top"><!-- --></A> <A HREF="#skip-navbar_top" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CE

Preview
{ private Dictionary commonDic, greDic; private DictionaryGUI gui; public Assignment4() { createCommon(); createGRE(); gui = new DictionaryGUI(commonDic, greDic); } private void createCommon() { //Common Dictionary JOptionPane.showMessageDialog(null, "Please select a file for " + "the common words dictionary.", "Select File", JOptionPane.PLAIN_MESSAGE); JFileChooser fileChooser = new JFileChooser(); fileChooser.setDialogTitle("Common Words Dictionary"); int result

Preview
/** * Adds an element to this set. Adds to the appropriate LinkedList by taking the wordHashCode() * and mod (%) by the table size. * @param s a HashableWord to add to the HashTable * @return the number of words currently in HashTable

Preview
= s.toUpperCase(); return dictionary.contains(new HashableWord(s)); } /** * check if words in an ArrayList are in the dictionary * @param words ArrayList of words to be checked * @return an ArrayList of all words not in dictionary */ @Override public ArrayList<String> checkWords(ArrayList<String> words) { ArrayList<String> notInDictionary = new ArrayList<String>(); for

Preview
= new Scanner(f); //clear the text area first textArea.setText(""); while (scan.hasNextLine()) { //and apped each line from the file to the text area textArea.append(scan.nextLine() + "\n"); } } catch (IOException ex) { //if there was an error reading the file, then exit the method JOptionPane.showMessageDialog(this, "There was an error reading

Preview
i++) { buckets[i] = new LinkedList<HashableWordInterface>(); } } /** * Adds an element to this set. Adds to the appropriate LinkedList by taking the wordHashCode() * and mod (%) by the table size. * @param s a HashableWord to add to the HashTable * @return the number of words currently

Preview
* @param s String * @return true if word is in dictionary or false if not */ public boolean checkWord(String s); /** * check if words in an ArrayList are in the dictionary * @param words ArrayList of words to be checked

Preview
{ return false; } //cast to a HashableWordInterface HashableWordInterface hwi = (HashableWordInterface) o; //call the equals method to compare to a HashableWordInterface return this.equals(hwi); } /** * Compares a String portion of a HashableWord to a String * portion of another HashableWord * @param s String to compare *

Preview
don't contain a sentence * * @param a ArrayList of Strings (sentences) * @param d the Dictionary to compare against * @return the ArrayList of Strings (sentences) that don't contain a gre word */ public ArrayList<String>

Preview
contain a gre word */ @Override public ArrayList<String> checkGRE(ArrayList<String> a, DictionaryInterface d) { //It seems pointless to use a HashTable in this class at all, but I //can't see how else we should implement one. HashTable sentances = new HashTable(); //For every sentance in a for (String s : a)

Preview
a HashableWord to a String * portion of another HashableWord * @param s String to compare * @return true is Strings are same or else false */ public boolean equals(HashableWordInterface s);

Preview
commonWords back to original commonWords.create(commonFile); } @Test public void testCheckGreArrayList() { result = greUtility.checkGRE(test1, greWords); //I added a period to "I hate tests" assertEquals(result.get(0), "I hate tests."); } @Test public void testCheckGreArrayListStudent() { //create some sentances String[] sentances = new String[] { "I abhor this sentance.", //has GRE "I like

Preview
CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="index.html?constant-values.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="constant-values.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A

Preview
NAME="serializedForm"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> <B>Serialized Fields</B></FONT></TH> </TR> </TABLE> <H3> commonDic</H3> <PRE> <A HREF="assignment4/Dictionary.html" title="class in assignment4">Dictionary</A> <B>commonDic</B></PRE> <DL> <DD>The dictionaries in use. <P> <DL> </DL> </DL> <HR> <H3> greDic</H3> <PRE> <A HREF="assignment4/Diction

Preview
java.io.Serializable) <UL> <LI TYPE="circle">java.awt.Container<UL> <LI TYPE="circle">java.awt.Window (implements javax.accessibility.Accessible) <UL> <LI TYPE="circle">java.awt.Frame (implements java.awt.MenuContainer) <UL> <LI TYPE="circle">javax.swing.JFrame (implements javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants) <UL> <LI TYPE="circle">assignment4.<A HREF="assignment4/DictionaryGUI.html" title="class in assignment4"><B>DictionaryGUI</B></A> (imp

Preview
SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="assignment4/package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FO

Preview
title="class in assignment4" target="classFrame">Assignment4</A> <BR> <A HREF="assignment4/Dictionary.html" title="class in assignment4" target="classFrame">Dictionary</A> <BR> <A HREF="assignment4/DictionaryGUI.html" title="class in assignment4" target="classFrame">DictionaryGUI</A> <BR> <A HREF="assignment4/DictionaryInterface.html" title="interface in assignment4" target="classFrame"><I>DictionaryInterface</I></A> <BR> <A HREF="assignment4/DictionaryUtility.html" title="class in assignment4"

Preview
size="+1" CLASS="FrameHeadingFont"> <B>All Classes</B></FONT> <BR> <TABLE BORDER="0" WIDTH="100%" SUMMARY=""> <TR> <TD NOWRAP><FONT CLASS="FrameItemFont"><A HREF="assignment4/Assignment4.html" title="class in assignment4">Assignment4</A> <BR> <A HREF="assignment4/Dictionary.html" title="class in assignment4">Dictionary</A> <BR> <A HREF="assignment4/DictionaryGUI.html" title="class in assignment4">DictionaryGUI</A> <BR> <A HREF="assignment4/DictionaryInterface.html" title="interface in assignmen

Preview
types)"> <FRAME src="assignment4/package-summary.html" name="classFrame" title="Package, class and interface descriptions" scrolling="yes"> <NOFRAMES> <H2> Frame Alert</H2> <P> This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. <BR> Link

Preview
its classes and interfaces, with a summary for each. This page can contain four categories:<UL> <LI>Interfaces (italic)<LI>Classes<LI>Enums<LI>Exceptions<LI>Errors<LI>Annotation Types</UL> </BLOCKQUOTE> <H3> Class/Interface</H3> <BLOCKQUOTE> <P> Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:<UL> <LI>Class inheritance diagram<L

Preview

Preview
SHORT SHOT SHOULD SHOW SHOWED SHOWN SIDE SIMILAR SIMPLE SIMPLY SINCE SINGLE SITUATION SIX SIZE SLOWLY SMALL SO SOCIAL SOCIETY SOME SOMETHING SOMETIMES SOMEWHAT SON SOON SORT SOUND SOUTH SOUTHERN SOVIET SPACE SPEAK SPECIAL SPECIFIC SPIRIT SPRING SQUARE ST STAFF STAGE STAND STANDARD START STARTED STATE STATEMENTS STATES STAY STEP

Preview
sponge spurious spurn squalid squander stanch steeply stentorian stickler stigma stigmatize sting stingy stint stipulate stolid strands stray streak striated stride strut stygian stymie subdue sublime submerge suborn subpoena subsume succor suffice sullied summarily sumptuous sundry supercilious superfluous superimpose supersede supine suppliant supplicate suppress surfeit susceptibility sustain sycophant synopsis taciturn

Preview
make me sick to my abdomen.

Screenshots
Screenshot
Screenshot
Purchase Answer

Eclipse Project For same problem

uetian_cute
uetian_cute 



The files contain eclipse project for the same problem. Attachments
Dictionary.zip (32 K) Download













Preview
DIFFERENT DIFFICULT DIRECT DIRECTION DIRECTLY DISTANCE DISTRICT DO DOES DOING DONE DONT DOOR DOUBT DOWN DR DRIVE DUE DURING E EACH EARLIER EARLY EARTH EAST EASY ECONOMIC EDUCATION EFFECT EFFECTIVE EFFECTS EFFORT EFFORTS EIGHT EITHER ELEMENTS ELSE END ENGLAND ENGLISH ENOUGH ENTIRE EQUIPMENT ESPECIALLY ESTABLISHED EUROPE EVEN EVENING EVER EVERY

Preview
alacrity alienate allegiance alleviate alloy aloof amalgamate ambidextrous ambiguous ambivalent ameliorate amendment amicable amortize amplify animosity annul anticlimax antidote antithetical apartheid apathetic aplomb apostate apotheosis appease apprehensive apprise approbation appropriate apropos apt arabesque arabesque arbitrate arboreal ardently ardor arduous argot arrant arrogance articulate ascend ascent ascertain ascetic ascribe asperity a

Preview
must adhere to my study schedule.

Preview
!= JFileChooser.APPROVE_OPTION) { JOptionPane.showMessageDialog(null, "No file was selected, " + "exiting program now.", "No File Error", JOptionPane.ERROR_MESSAGE); System.exit(0); } File greFile = fileChooser.getSelectedFile(); greDic = new Dictionary(); if (!greDic.create(greFile)) { JOptionPane.showMessageDialog(null, "There was an error reading " + "the file. Exiting the program.", "File Read Error", JOptionPane.ERROR_MESSAGE); System.exit(0); } }

Preview
s = new Scanner(f); //I am assuming the dictionary always has one word per line //so, while it has another line while (s.hasNextLine()) { //get the next line (make sure it is upper case) String line = s.nextLine().toUpperCase(); //make sure it isn't blank if (line.length() == 0) { continue; }

Preview
JButton("GRE Word Check"); readBUT = new JButton("Read Text File"); exitBUT = new JButton("Exit"); buttonContainer = new JPanel(); //add a border to the text area textArea.setBorder(BorderFactory.createTitledBorder( "Text for Spell and GRE Checker")); //add action listeners for all buttons.... spellCheckBUT.addActionListener(this); greCheckBUT.addActionListener(this); readBUT.addActionListener(this); exitBUT.addActionListener(this); //add all the buttons to their container button

Preview
interface DictionaryInterface { /** * check if a word is in the dictionary * @param s String * @return true if word is in dictionary or false if not */ public boolean checkWord(String s); /** * check if words in an

Preview
a gre word */ public ArrayList<String> checkGRE(ArrayList<String> a, DictionaryInterface d) { //It seems pointless to use a HashTable in this class at all, but I //can't see how else we should implement one. HashTable sentances = new HashTable(); //For every sentance in a for (String s : a) { //if

Preview
to compare against * @return the ArrayList of Strings (sentences) that don't contain a gre word */ public ArrayList<String> checkGRE(ArrayList<String> a, DictionaryInterface d); /** returns true if the String (sentence) contains a gre word *

Preview
HashableWord * @param s String to compare * @return true is Strings are same or else false */ public boolean equals(HashableWordInterface s) { //if s is null, then it is not equal to this if (s == null) return false; //if s is this object, they are equal if

Preview
int hashCode(); /** * Compares a String portion of a HashableWord to a String * portion of another HashableWord * @param s String to compare * @return true is Strings are same

Preview
that bucket LinkedList<HashableWordInterface> list = buckets[pos]; //return whether or not that bucket contains the word return list.contains(s); } /** * Puts the words in the hashtable in a sorted ArrayList * @return ArrayList of words in hashtable in sorted order */ public ArrayList<String> sort() { //create an array list to

Preview
import java.util.ArrayList; /** methods for a HashTable of Strings. An array of LinkedLists * * @author Professor Myers * */ public interface HashTableInterface { /** * Adds an element to this set. Adds to the appropriate LinkedList by taking

Preview
} @Test public void testCheckWordsStudent() { //create a test dictionary String[] testDicWords = new String[]{ "apple", "grape", "banana", "cherry", "lime", "lemon", "pear", "kiwi" }; Dictionary testDic = new Dictionary(); for (String s : testDicWords) { testDic.add(s); } //test words to find in dictionary String[] testWords = new String[] {

Screenshots
Purchase Answer