Question: I was given the following sample code in order to create Java code that creates a book index from both user input and .txt file
I was given the following sample code in order to create Java code that creates a book index from both user input and .txt file input.

When ig.registerWord() is called, the current page should be associated with the word passed in. For this part, each page is 1 word long.
When operating on a .txt file, consider 500 words to be on 1 page, and any word used on more than 10 pages should NOT be included in the index.
I need an IndexGenerator with these classes:
registerWord(String s) //Registers word to index
setPage(int x) //Sets page number
printIndex(java.io.PrintStream out) //prints output of index
This should be done in a Map inside the IndexGenerator.
I also need the following classes: int wordCount() //return the number of different words in the index
String mostCommon() //return a word that appears on the most different pages
TIA!
public class TestDriver 1 public static void main(String [] args) Scanner input -new Scanner (System. in); IndexGenerator ig new IndexGenerator(); input.useDelimiter(" [a-zA-Z]+"); int page-0; for (int i-0; i
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
