Question: Driver #include #include #include #include string_class.h using namespace std; int main() { /*string_class s; cout string_class r(hello); cout cout string response = Y; string ss;

Driver
#include
#include
#include
#include "string_class.h"
using namespace std;
int main()
{
/*string_class s;
cout
string_class r("hello");
cout
cout
string response = "Y";
string ss;
while (response == "Y" || response == "y")
{
cout
getline(cin, ss);
string_class main_string(ss);
if (main_string.palindrome())
{
cout
}
else
{
cout
}
cout
getline( cin,response);
}
cout
cout
response = "y";
string current, old_substring, new_substring;
while (response == "Y" || response == "y")
{
cout
getline(cin, current);
string_class current_string(current);
cout
getline(cin, old_substring);
cout
getline(cin, new_substring);
cout
current_string.replace_all(old_substring, new_substring);
cout
cout
cout
getline(cin, response);
cout
}
cout
return 0;
}
In this assignment you will implement a class called string_class. Place the class declaration in the file string_class.h"and the class implementation in the file "string_class.cpp". The class has the following characteristics 1. A private string variable "current_string. 2. A default constructor that sets current_string" to an empty string (). 3. An explicit-value constructor that sets current_string equal to the argument that is passed to the explicit-value constructor when a string_class object is declared. 4. A public member Boolean function called palindrome that returns true if the current_string reads the same forward as it does backwards; otherwise it return false. For example madam, 463364, and ABLE WASI ERE I SAW ELBA are all palindromes. 5. A public member void function called replace_all that accepts two string arguments, old_substring and new_substring. The function will replace each occurrenceof old_substring with new_substring in "current_string". For example, when the function is invoked, if current_string = aaabbacceeaaa, old_substring="aa", and new_substring=zzz, then after execution of the function, current_string= zzzabbacceezzza. Note special cases: If current_string is empty, or if old_substring is larger than current_string, or if old_substring is not located in current_string, then the value of current_string will not change. DO NOT USE THE STRING CLASS FUNCTIONS find, replace, orsubstr. 6. Overload the insertion operator(
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
