In: Computer Science
Problem: Text manipulation as a technology has a myriad of applications, including coding and decoding, textual analysis to determine authorship of a document, and automatic translation between languages. Learning to parse and process textual data is a valuable skill to master.
Your assignment: Design, develop, and test an
Object-Oriented C++ program to process multi-word phrases and
sentences in a variety of ways. In this case, the required
processing includes 1) reversing the words in a phrase, 2) sorting
the words within the phrase in ascending order, and 3) applying the
Rot13 encoding to all the characters in the original phrase.
Discussion: Phrases are composed of words, which
are in turn composed of characters. In C++, those characters are
represented as bytes, using the ASCII standard to encode each
character as a number. Parsing a string involves breaking a string
up into its component words, using spaces as the delimiters between
words. This project requires first that the user’s input phrase be
parsed into its component words, and then each word must be handled
as an individual entity. In all the phrase processing except the
Rot13 conversion, words must be kept intact.
Consider the following issues when preparing your solution.
- Create a user-defined Phrase class to manage a phrase and the
words within it. This class must have one or more constructor(s)
for initialization and multiple methods to perform the various
operations on the phrase and its words.
- Create a single instance of the class in function main()
- Repeat the following steps until the user opts to quit:
- Prompt the user for a phrase or sentence, and read it into a single string
- Initialize the Phrase object with the user-input string
- Display the following conversions of the user-input string as produced by public methods of the Phrase class. The case of each letter must be preserved from the input string to each of these conversions. Each conversion must produce a separate output string.
- Reversed word order
- Sorted word order
- Rot13 character encoding
- In the Reversed Word and Sorted Word conversions, all words must remain intact and readable with regards to the spelling and capitalization of each word. For this assignment, leading and trailing punctuation should be considered a part of each word.
Coding:
- Each user-defined class must be defined within its own set of .h (.hpp in Xcode) and .cpp files.
- There should be three files.
- The first file is main.cpp.
- The second file is Phrase.cpp The is the file where the definitions are written for the classes.
- The third file is Phrase.h This is the header file where the functions are declared for the classes.
- The program must accept any string, including multiple words with embedded spaces, as input.
- Validate all inputs and do not proceed until valid values are entered.For input strings, the only validation required is that the input string must not be empty.
Hopefully I can get some serious help on this one - this has been answered before on here, but the provided answers are all copies of one another that use the same code and do not work as required. Please do not use the previous solutions/helps that others uploaded since they use the same code and do not work as required. Any help would be greatly appreciated and will be upvoted.
Make the program as simple as possible. Use introductory Object-Oriented C++ programming. If all the requirements are met, then this will be upvoted.