Question: - Your program should keep track of the following information about the input file - The total number of lines in the file - The



- Your program should keep track of the following information about the input file - The total number of lines in the file - The total number of tokens in the file - The total number of tokens that are integers - The sum of all of the integer tokens - You can use a StringTokenizer to split the input lines into individual tokens (or a Scanner or String.split()) - Being we covered the StringTokenizer class and String. split() in lecture, those will probably be the easiest. - If you are feeling ambitious, you are free to try to utilize the Scanner class instead. -This is by no means a requirement, use whichever is more comfortable for you. - Additionally, for each of the commandline arguments after the first one, we need to track: - The number of tokens that match that string without taking into account the case - (that is, if the second commandline argument is "ab", then any token that is "ab", "Ab", "aB", or "AB" shall be considered matches) - The string class has a method equalsIgnoreCase() that should make this easy xpected Output - Your program should output the following information after reading the input file: - The total number of lines in the file - The total number of tokens in the file - The total number of tokens that are integers - The sum of all of the integer tokens - For each of the commandline arguments after the first one, in the same order that they were entered: - The argument followed by the number of matches in the file - IMPORTANT: Use a long for the sum of all of the integer tokens ormating - To make it easier for the TA/CA to evaluate your demo, use the following DecimalFormat object to format your int and long output values: - java.text.DecimalFornat df = new java.text.DecimalFornat ("\#\#\#, - Example - Assuming intsum contains the sum of the integers we can format it with the DecimaFornal object df via: - System. out. println("intSum =+df. format ( intSum)); timple Example - An input filename "sample_file_1.txt" has been provided for you. - the content is one just line: "a b c de f g 111230 lineCount =1 tokenCount =13 intCount =6 int =6 um =8 lineCount =1 tokenCount =13 int Count =6 in t Sum =8 a count =1 b count =1 c count =1 x count =0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
