Question
-Write in java Write a program that reads a text file and counts the number of times each English word appears. Display the 25 most
-Write in java
Write a program that reads a text file and counts the number of times each English word appears. Display the 25 most frequently used words. The program requires two classes, the main program and a separate class called UseCount to hold a word and its count. The UseCount class needs two instance variables, one String to hold the English word and an int to hold the count of times this word appeared in the text. A constructor for UseCount should have one parameter to initialize the English word. The count should be initialized to one. The main program needs to sort an array of UseCount objects. To be sorted, the UseCount class must implement the Comparable interface and include a method compareTo. The class statement for UseCount should look like:
CatInTheHat.txt: https://docs.google.com/document/d/1f6UBKr6xmpTYApgak2_ZfbR_HWxj_tHfswFp5Bw25jg/edit
Frankenstein.txt: https://docs.google.com/document/d/1wWoIHdWgp8WwwKUcMOshit8f8aReelo7-JjBLcm9SGg/edit
PeterRabbit.txt: https://docs.google.com/document/d/1G2d_CDIQ-hRhIbXJGUo_EZ3bXBxAxuLP_g3-UWnGg9k/edit
Write a program that reads a text file and counts the number of times each English word appears. Display the 25 most frequently used words. The program requires two classes, the main program and a separate class called UseCount to hold a word and its count. The UseCount class needs two instance variables, one String to hold the English word and an int to hold the count of times this word appeared in the text. A constructor for UseCount should have one parameter to initialize the English word. The count should be initialized to one The main program needs to sort an array of UseCount objects. To be sorted, the UseCount class must implement the Comparable interface and include a method compareTo. The class statement for UseCount should look like public class UseCount implements ComparableStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started