CSC220 Lab Number 10
Due: 11:59PM, Tuesday, April 28
The goal of this assignment is to write a program that reads words from a given text file and stores the pairs (Word, Line Number), sorts the words after completing the read, and then prints out the result. The class WordInt is designed for storing a pair. It has a constructor, a comparator, and a toString methods. Since this is an assignment associated with a chapter on sorting, you must solve the problem using one of the sorting methods discussed in the chapter: (i) you construct an array of WordInt objects while reading the data from the input file, (ii) use one of the sorting algorithms to sort the array, and (iii) produce the output from the sorted array. You can use a coded version of the QuickSort algorithm: QuickSort.java by the authors of the book. Sample program is here. You may regard a dash as a space on a dash. A problem arises when a word is followed by two dashes. The sample program does NOT solve this issue, FYI. The following texts are downloaded from Project Gutenberg.