Question
Lab 4 Design a class named TextAnalyzer with features to analyze a text file. Your class should have the following member functions: Constructor : will
Lab 4
Design a class named TextAnalyzer with features to analyze a text file. Your class should have the following member functions:
Constructor: will receive a file name as a parameter and read its content. Set a status member variable to tell whether or not the file was uploaded successfully.
isUploaded: returns true if the file was uploaded successfully. This status is saved in a member variable that you defined in your class.
sentenceCounter: will return how many sentences there is in the text
wordCounter: will return how many words there is in the text
properNouns: will return how many potential proper nouns were found. Proper nouns start with a capital letter.
digitsCounter: will return how many digits were found in the text
Important: use the functions for character processing that you learned in Module 6.
Your class will need at least the following member variables:
A string to hold the text. You can choose either a string or c-string type variable. Note that c-strings will need to be allocated dynamically and will require you to define a destructor to deallocate that memory space.
A status variable to flag whether or not a file was uploaded to the object. All counter functions should check this status variable before proceeding to counting. Note that trying to count on an empty text may make your program crash.
Write a main program to test your class. You don't have to turn it in. Only turn in a .cpp or .h file with your class implementation. I will use it with my own main program. Note that you MUST follow the member function names that I listed because those are the names that I will call in my program.
please tell me what else is needed for this lab.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started