Question
Visual Studio 2019 Separate your class header and implementation files into their respective .h and .cpp files. Always include #pragma once at the top of
- Visual Studio 2019
- Separate your class header and implementation files into their respective .h and .cpp files.
- Always include #pragma once at the top of each header file.
- Get in the habit of creating destructors in all of your classes.Once we start using inheritance and polymorphism, they will be essential to proper functioning of your programs.
This assignment uses pointers to perform something done often in computer applications: the parsing of text to find "words" (i.e., strings delineated by some delimiter).
Assume you are working in the marketing department of a company that sells computers and accessories.Your team has been tasked with determining how customers perceive your products based on customer surveys.The questions in the surveys are open-ended.That is, customers write product reviews as paragraphs about their perceptions of your products.Your job is to prepare the customer responses to facilitate a sentiment analysis.
Class Construction:
create a class called Word that stores a word from a product review in a data member called "word." The class should also contain an integer variable representing the number of times (i.e. frequency) that the word was found in a product review document.The class should have a one-argument constructor that receives a pointer to a c-string (character array) containing the word as its one parameter.(Note that the output of the strtok_s function described above is a pointer to a c-string containing the word that was parsed. This is what you will pass in to the Word constructor.) The Word constructor should also set the frequency of this Word object to 1.Appropriate set and get functions should be included for both the word and frequency data members.
create a class called Review that contains a vector of objects of the Word class.The class should contain functions to add a new Word object to the vector and to print out all of the Words in the vector with their respective frequencies.
Main()
In main(), show an object of the Review class.You will use this object to call the functions in the Review class that will manage the words retrieved from the document.
Data Inputs:
You will prompt the user to enter a file that contains the product review. (Be sure to include error checking to ensure that the file can be successfully opened.)Assume that the sentences in the review consist of words separated by blanks, commas, and periods. There are no punctuation marks, such as exclamation points, semi-colons, colons, etc.Only periods and commas exist in each sentence.
A product review is less than 1000 characters.
Here is an example of what a product review could look like:
The laptop I purchased was awesome.It had twice as much memory and processing speed as my last computer, yet it was small and lightweight.I am very pleased with this purchase and the awesome customer service I received. I also purchased some accessories that were really great, too. Thanks for being such a great and awesome company.I will be purchasing more from you in the future.
The output of the program should be a listing of all of the words in the review with a count of their frequencies.You do not have to assign meaning to any of these words as would be required in a full-blown sentiment analysis.However, this program performs the necessary first steps in preparing the data for a more extensive investigation of consumer sentiment.
char seps[] = " ,.!:;" ;
char* token =NULL;
char* next_token =NULL;
token =NULL;
next_token =NULL;
token = strtok_s(sentence, seps, &next_token);
token = strtok_s(NULL, seps, &next_token);
Constructor(s) as appropriate
Data members:word and frequency
Functions:ConvertToLowerCase, getters/setters as appropriate
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