Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Size File to run Delete bill-of-rights.txt 2.86 KB dictionary.txt 213.19 KB FileStatsDemo.java o 1.38 KB * romeo-and-juliet.txt 143.58 KB FileStats.java o 1 KB 10 points
Size File to run Delete bill-of-rights.txt 2.86 KB dictionary.txt 213.19 KB FileStatsDemo.java o 1.38 KB * romeo-and-juliet.txt 143.58 KB FileStats.java o 1 KB 10 points Make a class that represents a file. This class will have the ability to calculate the number of lines in that file and the ability to search through the file. The getNumMatchingWords method will take a bit of text and determine how many lines contain that text. Make the comparison not care about case. Example: if the user is searching for hello and a line contains the text hello hello hello then this counts as one. Use the contains method defined on Strings to help with this. Class Name FileStats Fields - filename: String Methods + FileStats(filename: String) + getNumMatchingWords(key: String): int + getNumLines(): int Test Case 1 Test Case 1 -- Num lines in Bill of Rights: 65 Num lines in Romeo and Juliet: 5268 Num lines in dictionary: 21882 In Bill of Rights Test In 'the' count: 29 'no' count: 17 'rights' count: 2 Romeo and Juliet Test ' Romeo' count: 304 Juliet' count: 185 'end' count: 95 'emoji' count: 0 - in
Step 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