Question: JAVA Modify the code in the WordFreq and WordFreqCounter class so that the output gives the frequencies and words listed in order with respect to

JAVAJAVA Modify the code in the WordFreq and WordFreqCounter class so thatthe output gives the frequencies and words listed in order with respectto the frequency (highest to lowest), instead of alphabetical order. The codethat prints the WordFrequency tree is: for (WordFreq wordFromTree: tree) if (wordFromTree.getFreq)>minFreq) numValidFreqs++ System.out.println(wordFromTree); Given below is what the current output looks like

Modify the code in the WordFreq and WordFreqCounter class so that the output gives the frequencies and words listed in order with respect to the frequency (highest to lowest), instead of alphabetical order. The code that prints the WordFrequency tree is: for (WordFreq wordFromTree: tree) if (wordFromTree.getFreq) >minFreq) numValidFreqs++ System.out.println(wordFromTree); Given below is what the current output looks like (please make sure your input file is local to the project and not the src folder): File name > PrivacyActOf1974.txt Minimum word size> 5 Minimum word frequency> 10 The words of length 5 and above, with frequency counts of 10 and above: Freq Word 00017 about 00013 access 00011 accordance 00018 action 00023 agencies 00054 agency 00026 alien 00016 applicable 00018 appropriate 00010 assist 00024 benefit 00012 benefits 00016 birth 00010 chief 00017 citizenship 00012 civil 00018 collection 00012 component 00016 contained 00014 contains 00010 control 00017 country 00012 covered 00013 criminal

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!