Question
Your program should then open that specific file. (Assume the file will be .txt).
Your program should then calculate the following information based on the specified text file:
1. The total number of words in the file
2. The number of lines in the file
3. The number of characters in the file (not including spaces)
Once the information is calculated, print the data to the screen and also to a new file called results.txt.
Solution Preview
This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.
import java.io.File;import java.io.FileNotFoundException;
import java.util.Scanner;
/**
*
* @author
*/
public class Assignment {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
Scanner console = new Scanner(System.in);
System.out.print("Enter file name (or path): ");
String name = console.nextLine();
int line = 0;
int word = 0;
int character = 0;
String next;...