You must create a Java program that counts the number of times a word appears in a file. Words should be split by any whitespace character, including spaces, tabs, and newline characters. Partial searches should count towards the total and capitalization should not matter. For example, the word "sea" should match the word "Search" and "seashell". You do not need to worry about other special characters.
You must submit this homework to your SVN repository using Eclipse. Your homework, including the src directory and all required source code files must be at the following location:
https://www.cs.usfca.edu/svn/<username>/cs212/homework05/
where <username> is your CS username in all lowercase letters. Failure to properly submit your homework will result in a point deduction.
You must submit this programming homework by 11:59pm on Friday, March 01, 2013.
You must create a class WordCounter that has the following methods:
public static int countString(String text, String query)
public static int countFile(String name, String query)
public static int countFile(File file, String query)
These methods should return the number of words found that start with the query. Words should be split by any whitespace character, including spaces, tabs, and newlines. Partial searches should count towards the total and capitalization should not matter. You do not need to worry about other special characters.
Your code must have proper exception handling and input validation.
Use the provided unit tests to test your code. Keep in mind it will also be reviewed for proper exception handling and input validation.