Design and develop an Object-Oriented C++ program that prepares a concordance of all the words in
any user-selected text file. A concordance is defined as “an alphabetical index of the principal words of a
book or document, with a reference to the passage in which each occurs.” To do this, your program will
need to read the contents of a text file, keeping track of line numbers. Then record each word with its
current line number. Your finished result will be a file containing an alphabetical listing of all the words,
and with each word, the number of times that word appeared in the document, and a list of the line
numbers on which that word was found. You must allow the user to select a file from a menu of
available files and save the results in a file named “[originalname][url removed, login to view]” where
[originalname] is the name of the input file without its extension. Here are the specific coding
Create a UniqueWord class with the following attributes and methods:
o One string variable to contain the word being cataloged
o One vector of whole numbers containing the line numbers where this word was found
in the file
o One constructor that accepts a string and a line number, saves it in the string variable
and initializes the vector with the line number
o One method to add a line number (argument) to the current word’s vector of line
o One method to compare the current UniqueWord’s text to another UniqueWord’s text.
The function must return an integer value of +1 if the first argument sorts alphabetically
before the second, 0 if both strings are equal, and -1 if the second string sorts
alphabetically before the first. Use this function when searching the concordance vector
for new words.
o One toString method to format the word, its occurrence count, and its line numbers into
a single string for output in this format: word(occurrences): line, line, line, line, line
o Other variables and methods as necessary
Create a Concordance class with the following attributes and methods:
o One vector of pointers to UniqueWord objects. The UniqueWord objects in this list must
be kept in ascending alphabetical order.
o One default constructor that initializes the vector list to be empty
o One method to reset the concordance to an empty list
o One method to add a word and line number to the concordance. This method must
determine whether the word already exists in the concordance. If it does, the word’s
line number must be added to the existing word’s list of line numbers. If the word does
not already exist in the concordance, a new UniqueWord object must be created and
initialized with the new word and its line number. Then the new UniqueWord must be
inserted into the concordance in its proper alphabetical location.
o One method to save the contents of the concordance to a user-specified file.
o Other variables and methods as necessary
Create a menu-driven program that offers the user a list of available text files. The user will
select a file by name or by its number in the menu.
The program must have a single Concordance object created from the Concordance class
described above. This object must be created or reset each time an input data file is opened.
Open the user-selected file and read it line-by-line. For each line, parse the line to identify each
individual word, convert each word to lowercase, and remove all leading and trailing
punctuation. Do not remove embedded periods, hyphens, or apostrophes.
For each word, use the Condordance object’s method to add the word to the concordance. When the end of the file has been reached and all words have been cataloged, write the
contents of the concordance object to a new file, named “[originalfilename][url removed, login to view]”
where [originalfilename] is the name of the input file without its filename extension.
Allow the user to repeat this process for as many input files as they want
Each object must be defined within its own set of .h and .cpp files.
Validate all inputs and do not proceed until valid values are entered.
Format your source code according to the style guide presented in class.
In the Concordance class, implement a binary search of the concordance vector to find a word in
Data files (these were downloaded from [url removed, login to view])
[url removed, login to view] – A Modest Proposal by Jonathan Swift
[url removed, login to view] – Apology by Plato
[url removed, login to view] – The Wonderful Wizard of Oz by Frank Baum
[url removed, login to view] – The Adventures of Sherlock Holmes by Sir Arthur Conan Doyle
Turn in a single zip file containing your source code in one or more “.h” and “.cpp” files. Name the zip
file “First Last HW7”, where “First Last” is replaced with your First and Last names.
Hi,hope you are fine and doing great.i have seen detail and don't wanna waste your time to introduce [url removed, login to view] Expert and can do it [url removed, login to view] ready for this job right [url removed, login to view] give me this [url removed, login to view] you Rega Mais
7 freelancers are bidding on average $34 for this job
Hi there- My name is imran.I am highly Expert in this field. I'll provide you satisfaction. So your time and money will be safe when you will award me project. take a look at my Freelancer Portfolio
HI Contact me for an efficient, perfect, well documented development of your project according to 100% accuracy and requirements, with dedicated support. Thanks Farah Saif