Question: Please do Question 5. Programming language C++: Thank you. if the question needs more info please let me know. 4. Enhance the definition of the

Please do Question 5. Programming language C++: Thank you. Please do Question 5. Programming language C++: Thank you. if the questionneeds more info please let me know. 4. Enhance the definition of

if the question needs more info please let me know.

4. Enhance the definition of the class StringVar given in Displays 11.11 and 11.12 by adding all of the following: Member function copyPiece, which returns a specified substring; member function oneChar, which returns a specified single char- acter; and member function setChar, which changes a specified character An overloaded version of the == operator (note that only the string values have to be equal; the values of maxLength need not be the same) An overloaded version of + that performs concatenation of strings of type StringVar An overloaded version of the extraction operator >> that reads one word (as opposed to inputLine, which reads a whole line) If you did the section on overloading the assignment operator, then add it as well. Also write a suitable test program and thoroughly test your class definition. 5. Define a class called Text whose objects store lists of words. The class Text will be just like the class StringVar except that the class Text will use a dy- namic array with base type StringVar rather than base type char and will mark the end of the array with a StringVar object consisting of a single blank, rather than using '10' as the end marker. Intuitively, an object of the class Text represents some text consisting of words separated by blanks. Enforce the restriction that the array elements of type StringVar contain no blanks (except for the end marker elements of type StringVar). Your class Text will have member functions corresponding to all the member functions of StringVar. The constructor with an argument of type const char a[] will initialize the Text object in the same way as described below for inputLine. If the C-string argument contains the new-line symbol ' ', that is considered an error and ends the program with an error message. The member function inputLine will read blank separated strings and store each string in one element of the dynamic array with base type StringVar. Multiple blank spaces are treated the same as a single blank space. When outputting an object of the class Text, insert one blank between each value of type Stringvar. You may either assume that no tab symbols are used or you can treat the tab symbols the same as a blank; if this is a class assignment, ask your instructor how you should treat the tab symbol. Add the enhancements described in Programming Project 6. The overloaded version of the extraction operator >> will fill only one element of the dynamic array. 4. Enhance the definition of the class StringVar given in Displays 11.11 and 11.12 by adding all of the following: Member function copyPiece, which returns a specified substring; member function oneChar, which returns a specified single char- acter; and member function setChar, which changes a specified character An overloaded version of the == operator (note that only the string values have to be equal; the values of maxLength need not be the same) An overloaded version of + that performs concatenation of strings of type StringVar An overloaded version of the extraction operator >> that reads one word (as opposed to inputLine, which reads a whole line) If you did the section on overloading the assignment operator, then add it as well. Also write a suitable test program and thoroughly test your class definition. 5. Define a class called Text whose objects store lists of words. The class Text will be just like the class StringVar except that the class Text will use a dy- namic array with base type StringVar rather than base type char and will mark the end of the array with a StringVar object consisting of a single blank, rather than using '10' as the end marker. Intuitively, an object of the class Text represents some text consisting of words separated by blanks. Enforce the restriction that the array elements of type StringVar contain no blanks (except for the end marker elements of type StringVar). Your class Text will have member functions corresponding to all the member functions of StringVar. The constructor with an argument of type const char a[] will initialize the Text object in the same way as described below for inputLine. If the C-string argument contains the new-line symbol ' ', that is considered an error and ends the program with an error message. The member function inputLine will read blank separated strings and store each string in one element of the dynamic array with base type StringVar. Multiple blank spaces are treated the same as a single blank space. When outputting an object of the class Text, insert one blank between each value of type Stringvar. You may either assume that no tab symbols are used or you can treat the tab symbols the same as a blank; if this is a class assignment, ask your instructor how you should treat the tab symbol. Add the enhancements described in Programming Project 6. The overloaded version of the extraction operator >> will fill only one element of the dynamic array

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!