Question: Write a program in Java to count the occurrences of each word in a large text file (like a book) Allow the user to type

Write a program in Java to count the occurrences of each word in a large text file (like a book)

Allow the user to type a word and report how many times that word appeared in the book.

Report all words that appeared in the book at least 500 times, in alphabetical order.

Write the solution as a Class

A HashMap to store the words and times it appears

Constructor accepting a file or a path String

reportWord(String word) method return the times the given word parameter appears

reportWordOver(int times) method that output all words that appears more than the given times.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!