Question: reads an ASCII text file, and asks the user the maximum # of characters to read (say X). As for reading the input file, you

  • reads an ASCII text file, and asks the user the maximum # of characters to read (say X). As for reading the input file, you should implement your program similar to "TextFileReadPrint" java program that was given to you in Exercise 1. // Call below reads text file into a very long string with line breaks. lines = readTextFile(args[0]);
  • If the number of characters in the file is greater than X, then the program should display an error message. X should be an input entered at run time. Beware of bad input from the user.
  • On the console, the program should print out the following statistics:
  1. Total Number of words in the file. A word is a sequence of letters.
  2. Total Number of numbers in the file. A number is a sequence of digits.
  3. Total Number of characters including spaces (but no line breaks).
  4. Total Number of spaces (any whitespace, but no line breaks).
  5. Total Number of punctuations characters (e.g. ".", "!", ";", etc.)
  6. Total Number of characters in upper case.
  7. Total Number of characters in lower case.
  • On the console, the program then to print out the content of the file in reverse order while converting all letters to lower case. For example; if the input of the file is : "This is the First Assignment !", then the output should be: "! tnemngissa tsrif eht si siht"

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!