Question: Write a program that reads a file called TextFile.txt. The program prints total number of characters (non-whitespace, non-punctuation marks), total words, unique words, and lines

 Write a program that reads a file called TextFile.txt. The program

Write a program that reads a file called TextFile.txt. The program prints total number of characters (non-whitespace, non-punctuation marks), total words, unique words, and lines in that file. The program also prompts the user for a word and displays the number of times this word occurs in the file. Consider upper case, lower case, and mixed case as same. For example: Footbal1, football, and FOOTBALL, are treated as same word Use try...catch logic Imagine the input text file contains following text data: American football, referred to as football in the United States and Canada, and also known as gridiron football or simply gridiron, is a sport played by two teams of eleven players on a rectangular field with goalposts at each end. The offense, which is the team controlling the oval-shaped football, attempts to advance down the field by running with or passing the ball, while the defense, which is the team without control of the ball, aims to stop the offense's advance and aims to take control of the ball for themselves Sample Output Enter the word you want to search: football The input document contains 436 Characters 92 Words 56 Unique Words The word footbal1 occurs 4 times

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 Databases Questions!