In this project, you will implement a sorting algorithm, using a comparator object. You can use either the merge-sort algorithm or the quick-sort algorithm.
For the demonstration applet you should allow the user to specify a URL for a document on the Internet and hit either the return key or a "sort" button. The applet should then go and read in that document, line by line, and insert the words from each line of text into a sequence of strings. You should then sort that sequence using the lexicographic (alphabetic) order, i.e., with a comparator that uses this ordering for its comparison rule, and then print in a scroll window an ordered listing of the words from the document, with each word appearing only once and being followed by a count of how many times it appears in the document.
You may use the following Java applet class and html document to aid in your development of the demonstration applet:
You may also use the following class that extracts the different text lines in a document on the internet and returns them, line by line, in an enumeration. You would use this class by reading in each line of text, parsing that into words, and adding those words to your sequence of words. You would then sort this sequence, and count up the occurrences of each word.
Note: due to Java security rules, you may only be able to access documents that are on the machine you are running the applet on.