Question: Write a java program that reads a given text file, outputs the text as is, and also prints the number of lines and the number
Write a java program that reads a given text file, outputs the text as is, and also prints the number of lines and the number of times each letter appears in the text. An uppercase letter and a lowercase letter are treated as being the same.
- Name your class TextProcessing.
- Name input file textIn.txt
-Main Method should function as a driver
- Program should read one line at a time and count the occurence of characters within a given line
Must include the following methods below:
public static void initializeLetterList(int[] letterCntList)
//initializes the components of the array letterCntList to zero
public static void updateCntList(String line,int[] letterCntList)
//counts the number of characters in the string line and updates the array letterCntList
public static void writeTotals(int lineCnt,int[] letterCntList,PrintWriter out)
//outputs the value of the variable lineCnt and contents of the array
//letterCntList to the output file referenced by the variable out
The text file is below:
Java is a general-purpose computer-programming language that is concurrent, class-based,
object-oriented,and specifically designed to have as few implementation dependencies as possible.
It is intended to let application developers "write once, run anywhere" (WORA),meaning that compiled
Java code can run on all platforms that support Java without the need for recompilation.Java
applications are typically compiled to bytecode that can run on any Java virtual machine (JVM)
regardless of computer architecture. As of 2016, Java is one of the most popular programming
languages in use, particularly for client-server web applications, with a reported
9 million developers. Java was originally developed by James Gosling at Sun Microsystems (which
has since been acquired by Oracle Corporation) and released in 1995 as a core component of Sun
Microsystems' Java platform. The language derives much of its syntax from C and C++,
but it has fewer low-level facilities than either of them. [Wikipedia].
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
