In C++ yhou will create a new class named StringMod that will have several functions specific to string. Here is a UML diagram: StringMod - str : string + StringMod() + StringMod(string); + size() const : int + backwards() const : string + count(char) const : int + getString() const : string + uppercase() const : string + lowercase() const : string + erase() : void + setString(string) : void First of all, none of these functions should contain output statements! No cout, no cin, in any of these functions! As you can see, several of the methods of StringMod are const, meaning they won’t change the internal string. You’ll likely declare a local string which will be updated and then returned. The default constructor just sets str to an empty string, "". The constructor with parameters should just call setString() to set str to the value passed to the constructor. backwards() returns a new string that is the reverse of the string in str. uppercase() takes every letter in the string and capitalizes it, while lowercase() does the opposite. Again, since these are all const, they don’t change the value of str. The erase() function sets str back to an empty string. The size() function returns the number of characters in the string (you can use the built in size() function that is in the string class here if you’d like, and call it within StringMod’s size() function. The count() function accepts a character as an argument, then counts the number of times that character appears in the string. For example, if "Aardvark" was the string and you were looking for 'a', it would return 2 (since A is different from a).

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

In C++

yhou will create a new class named StringMod that will have several functions specific to
string. Here is a UML diagram:
StringMod
- str : string
+ StringMod()
+ StringMod(string);
+ size() const : int
+ backwards() const : string
+ count(char) const : int
+ getString() const : string
+ uppercase() const : string
+ lowercase() const : string
+ erase() : void
+ setString(string) : void
First of all, none of these functions should contain output statements! No cout, no cin, in any of these
functions!
As you can see, several of the methods of StringMod are const, meaning they won’t change the
internal string. You’ll likely declare a local string which will be updated and then returned.
The default constructor just sets str to an empty string, "". The constructor with parameters should just
call setString() to set str to the value passed to the constructor.
backwards() returns a new string that is the reverse of the string in str.
uppercase() takes every letter in the string and capitalizes it, while lowercase() does the
opposite. Again, since these are all const, they don’t change the value of str. The erase() function
sets str back to an empty string.
The size() function returns the number of characters in the string (you can use the built in size()
function that is in the string class here if you’d like, and call it within StringMod’s size() function.
The count() function accepts a character as an argument, then counts the number of times that
character appears in the string. For example, if "Aardvark" was the string and you were looking for
'a', it would return 2 (since A is different from a).

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Header Files
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education