IndexBuilder takes a source file and the array of words to index and finds all o
ID: 3640656 • Letter: I
Question
IndexBuilder takes a source file and the array of words to index and finds all of the occurrences of each word in the file. Write a IndexBuilder that takes a file object named sourceFile and a String[] object named indexWords as constructor arguments.*The constructor should read the file line-by-line. As it reads each line, it should collect the following statistics:
*The total number of words and lines in the file.
* The lines where each index word appears - ignoring case and accounting for lines where an index word may appear more than once.
*You should only have to read each file once if you are doing this program properly.
* Write accessor methods as defined by the Interface for the number of words, number of lines, and for the arrays containing lines where each word was found.
* Write a toString() method that can be printed to summarize the statistics for the file.