Question: Write a class LineNumbers that has the method parseData (below) which reads a file containing text. The program counts the number of characters in that
Write a class LineNumbers that has the method parseData (below) which reads a file containing text. The program counts the number of characters in that file and the number of characters per each line. It then writes that information, along with the contents of the read file, to an output file. public static void parseData(File inputFile, File outputFile){ //Your code here } Use Scanner to read the contents of the input file and use PrintWriter to write out to the output file. Use string formatting to get the correct output. Each line after the first should be a print formatted string where: the number of characters in the line is a left justified String, width 10, and the content of the line itself is a right justified string of length 1. Be sure to include appropriate comments throughout your code and choose meaningful variable names. So if the input file is: `Twas brillig, and the slithy toves Did gyre and gimble in the wabe: All mimsy were the borogoves, And the mome raths outgrabe. Your program should write EXACTLY this to output.txt: File contains 124 characters 35 `Twas brillig, and the slithy toves 32 Did gyre and gimble in the wabe: 29 All mimsy were the borogoves, 28 And the mome raths outgrabe.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
