PROG 131 – Computer Programming II
Hands – on Exam Problem
Write a class named WordCount. This class contains a method wordCount that has a single String parameter, s. Assuming that s consists of words separated by whitespace, the method should return the number of words in s and the percentage of its use on the file. Words to be counted should be based on the words contained on the text file given. In comparing the words do not consider the case of the letters.
Sample words on the text file:
Testing can show the presence of errors, but not their absence.
Sample output of your program:
Word Count Report
Total number of words: 11
testing 1 0.09%
can 1 0.09%
show 1 0.09%
the 1 0.09%
presence 1 0.09%
of 1 0.09%
errors 1 0.09%
but 1 0.09%
not 1 0.09%
their 1 0.09%
absence 1 0.09%
• Display a word count report for each line in the given text file.
• The name of the input text file is wordCount_input.txt.
• Aside from displaying the word count report on the screen, write the output in a text file named wordCount_output.txt.
Note that this site is NotACodeMill (<= link). If you ShowSomeEffort (<= link), you'll get plenty of help. To simply do your homework for you, however, would be unethical and would rob you of the opportunity to learn.
Welcome to the Ranch, and good luck!
subject: Dont know what is this but its a programming Activity ..