Question: Java 20 most frequent words in a text file. Words are supposed to be stored in array that counts eah word. Write a program that

Java 20 most frequent words in a text file. Words are supposed to be stored in array that counts eah word.

Write a program that will read an article, parse each line into words, and keep track of how many times each word occurred. Run this program for each of the two articles and print out the 20 most frequently appearing words in each article.

You may think you need to use a StringTokenizer, but it turns out that is old programming. The better thing to use is string.split(regex)

Example of text to use:

If the subsidies vanish, low-income Americans who obtain insurance through Obamacare online marketplaces where insurers can sell policies would face higher insurance premiums and out-of-pocket medical costs. It would particularly hurt lower-middle-class families whose incomes are still too high to qualify for certain government assistance. About 10 million people are enrolled in Obamacare through its online marketplaces, and most receive subsidies. Trumps action came just weeks before the period starting on Nov. 1 when individuals have to begin enrolling for 2018 insurance coverage through the laws marketplaces. 

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!