Question: Write a program in JAVA that reads a file one character at a time and prints out how many characters are uppercase letters, lowercase letters,
Write a program in JAVA that reads a file one character at a time and prints out how many characters are uppercase letters, lowercase letters, digits, white space, and something else.
**Do not use hashmap. Please use character testing methods such as Character.isUpperCase,etc. If you can please provide an explanation or comments. Thanks!!
Complete the following file:
import java.io.File; import java.io.FileNotFoundException; import java.io.PrintWriter; import java.util.Scanner;
public class Characters { public static void main(String[] args) throws FileNotFoundException { Scanner console = new Scanner(System.in); System.out.print("Input file: "); String inputFileName = console.next(); . . .
System.out.println("Uppercase: " + uppercase); System.out.println("Lowercase: " + lowercase); System.out.println("Digits: " + digits); System.out.println("Whitespace: " + whitespace); System.out.println("Other: " + other); } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
