Question: analyzeFile(); accepts two parameters: the path to a file as a string, and another string (upper, lower, digit, or space); open the file, then determine
analyzeFile(); accepts two parameters: the path to a file as a string, and another string ("upper", "lower", digit", or "space"); open the file, then determine how many characters of the chosen type are in the file, then close the file; make the number available to the calling interface otherwise. analyzeFile() should call one of the following functions: countUpper (): return the number of uppercase letters in the file countLower(): return the number of lowercase letters in the file countDigits(): return the number of digits in the file countSpaces(): return the number of whitespace characters (including tabs but not line breaks) found in the file countWords(): return the number of whitespace characters (including tabs) found in the file isLower(): accepts a character as a parameter; return true if it is a lowercase letter and false otherwise isUpper(): accepts a character as a parameter; return true if it is an uppercase letter and false otherwise isDigit(): accepts a character as a parameter return true if it is a digit and false otherwise Use these functions to create a program that: Continuously prompts the user to enter: the path to a file as a string the type of character to be searched as a string When the file is successfully opened and a valid character type has been chosen: count the instances of the selected character type in the file Display the results Sample Run 1 (Inputs will be shaded. Bold outputs must change depending on the input.) Enter the absolute path to a file. S:\mbrown_shared\Input_Files\lab6-5.txt File opened successfully; what type of character should be counted? lowercase There are 93 lowercase letters in the file
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
