CSC 241- OPTIONAL Assignment 4 (Due May 15th 1998)


You may chose to do this project instead of taking the final

For this project you are expected to develop a web-based dictionary. The functionality provided to the user must allow for browsing for words, finding specific words, adding new words, removing words, and updating words in the dictionary.

The first thing that you must do is to build a dictionaryElement class and a Dictionary class: Here is the definition of these classes:


public class dicElement extends Object implements Keyed {
  public String key()
  public String meaning()
  public void setMeaning (String m)
  public  dicElement (String w, String m)
}

public class Dictionary extends Tree {
  public Dictionary () {}

  int eCount_=0;

  public void add(Keyed x) throws duplicateException {
    super.add(x);
    eCount_++;
  }

  public void remove(String key) throws notFoundException{
    super.remove(key);
    eCount_--;
  }

  public int count() {return eCount_;}

  /** if w is *, all word/meanings are returned in a vector, otherwise,
      return the subset of the elements that match "w" at the begining.
      For example, if w is "la", the vector returned will contain all words
      in the dictionary that start with the substring la.
   **/
  public Vector getDic (String w)
}

Your next task is to develop an Applet. There is a file that contains the word/meanings that you need to load into your dictionary. Java applets can read data files using the URL class. Dictionary Applet , is designed to show you how you read from such remote files. Second Dictionary Applet is designed to provide a bit more functionality. You have access to the source code for both of these applets, but neither use the Dictionary class for storage. You will receive 80% of the grade for this assignment, if you complete the Dictionary class and dicitonaryElement class and use them in an applet like Third Dictionary Applet . For full credit, you must design an applet that works the way Fourth Dictionary Applet does and provides full functionality.

Copy the data file dict.dat into an appropriate directory. Use the url of your file in the applet when constructing a URL object.