Question: Answer in Java Please and follow instructions. Given a Utilities class as follows: import java.io.File; import java.io.FileNotFoundException; import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class

Answer in Java Please and follow instructions.
Given a Utilities class as follows:
import java.io.File; import java.io.FileNotFoundException; import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class Utilities { public static final String DEFAULT_FILE = "sample.txt"; public static List readAFile() throws FileNotFoundException { return readAFile(DEFAULT_FILE); } public static List readAFile(String fileName) throws FileNotFoundException { ArrayList content = new ArrayList(); File f = new File(fileName); Scanner scan = new Scanner(f); while (scan.hasNextLine()) { String l = scan.nextLine(); Scanner lineBust = new Scanner(l); while (lineBust.hasNext()) { content.add(lineBust.next()); } lineBust.close(); content.add(" "); } scan.close(); return content; } public static void printAList(List list) { System.out.println(); for (String s: list) { System.out.print(s + " "); } System.out.println(); } }
Sample Executions:
Running a correct program using the SIL dictionary and the Bill of Rights, the following is output:
most frequent words
[the]
frequency 40
[the]
frequency 24
[of]
frequency 22
[to]
frequency 20
[be]
frequency 18
[in]
frequency 17
[shall]
frequency 15
[or]
frequency 14
[and]
frequency 10
[a, amendment]
frequency 9
[by]
frequency 8
[nor]
frequency 6
[for, law]
frequency 5
[no, not, people, right]
frequency 4
[any, have, jury, states]
frequency 3
[against, public, time, without]
frequency 2
[an, been, but, cause, common, constitution, crime, criminal, district, excessive, free, his, life, militia, otherwise, person, persons, process, property, state, trial, united, war, witnesses]
frequency 1
[abridging, according, accusation, accused, actual, affirmation, all, answer, are, arising, arms, ascertained, assemble, assistance, at, bail, bear, being, capital, case, cases, certain, committed, compelled, compensation, compulsory, confronted, congress, consent, construed, controversy, counsel, court, cruel, danger, defence, delegated, deny, deprived, describing, disparage, dollars, due, effects, enjoy, enumeration, establishment, exceed, except, exercise, fact, favor, fines, forces, freedom, government, grand, grievances, held, him, himself, house, houses, ii, iii, impartial, imposed, indictment, infamous, inflicted, informed, infringed, issue, it, iv, jeopardy, just, keep, land, liberty, limb, make, manner, nature, naval, necessary, oath, obtaining, offense, on, others, owner, papers, particularly, peace, peaceably, petition, place, powers, prescribed, presentment, preserved, press, previously, private, probable, prohibited, prohibiting, prosecutions, punishments, put, quartered, redress, reexamined, regulated, religion, required, reserved, respecting, respectively, retained, rights, rules, same, searched, searches, secure, security, seized, seizures, service, soldier, speech, speedy, subject, suits, supported, taken, than, their, thereof, things, tried, twenty, twice, unless, unreasonable, unusual, upon, use, value, violated, warrants, well, when, where, wherein, which, with, witness]
misspelled words
[I, IX, V, VI, VII, VIII, X]
Write a program that checks the spelling of words in a document. This program uses two text files: A dictionary file containing all known correctly spelled words, and A document to be spell-checked against the dictionary. . As the document to be spell checked is read, each of its words is checked against the dictionary words. The program determines whether each word is misspelled. Misspelled words are recorded. is spelled correctly. Correctly spelled words are recorded and their frequency counted. 0 The program outputs the most commonly used, correctly-spelled words. These words are listed in alphabetical order, ignoring case. all correctly spelled words, by frequency. If more than one word occurs with a given frequency, the words are displayed in alphabetical order, ignoring case. incorrectly spelled words in alphabetical order, ignoring case
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
