• 9. Write a program that reads a file one character at a time and prints out how many characters are uppercase letters,

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

• 9. Write a program that reads a file one character at a time and prints out how many characters are uppercase letters,

Post by answerhappygod »

9 Write A Program That Reads A File One Character At A Time And Prints Out How Many Characters Are Uppercase Letters 1
9 Write A Program That Reads A File One Character At A Time And Prints Out How Many Characters Are Uppercase Letters 1 (158.96 KiB) Viewed 34 times
Please complete the following code!!! Thanks!
• 9. Write a program 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. Characters.java 1 import java.io.File; 2 import java.io.FileNotFoundException; 3 import java.io.PrintWriter; 4 import java.util.Scanner; 5 6 public class Characters 7 { 8 public static void main(String[] args) throws FileNotFoundException 9 { 10 Scanner console = new Scanner(System.in); 11 System.out.print("Input file: "); 12 String inputFileName = console.next(); 13 int uppercase = 0; 14 int lowercase = 0; 15 int digits = 0; 16 int whitespace = 0; 17 int other = 0; 18 19 while (...) 20 { 21 22 if (. ..) { uppercase++; } 23 else if (...) { lowercase++; } 24 else if (...) { digits++; } 25 else if (...) { whitespace++; } 26 else other++; 27 } 28 29 System.out.println("Uppercase: " + uppercase); 30 System.out.println("Lowercase: + lowercase); 31 System.out.println("Digits: " + digits); 32 System.out.println("Whitespace: + whitespace); 33 System.out.println("Other: " + other); 34 } 35} 11
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply