Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

could someone help!!!!!! thank you!!!! i just have no ideas how to get started :) thats all thanks got it yString class tring class that

could someone help!!!!!!
thank you!!!!
i just have no ideas how to get started :) image text in transcribed
thats all
thanks image text in transcribed
got it image text in transcribed
yString class tring class that supports custom operators, such as addition, equality, and stream ins this assignment, you are to create supports custom d extraction. Following describes the member functions and operators of the MyString class: .MyString(); . Mystring(const char src); . Mystring(const char* src); . MyString(const Mystring& src); .MyString): . int GetLength() const; // default constructor /I constructor: creating a string from a cha /I constructor: creating a string from C-str // copy constructor // destructor // getter /I getter // setter II copy assignment operator // copy assignment operator /I copy assignment operator /I addition operator 1/ addition operator char GetCharAt (int index) const; void SetCharAt (int index, char ch) const; MyString& operator (const char rhs); MyString& operator (const chan* rhs); MyString& operator (const MyString& rhs); . MyString operator+ (const char rhs) const; .MyString operator+ (const char* rhs) const; MyString operator+ (const MyString& rhs) const; / addition operator // addition assignment operator // addition assignment operator // addition assignment operator /I equal-to operator I/ equal-to operator /1 not-equal-to operator // not-equal-to operator .MyString& operator+-(const char rhs); MyString& operator+ (const char* rhs); MyString& operator+ (const MyString& rhs); bool operator-(const MyString& rhs) const bool operator (const char rhs) const; . bool operator!-(const MyString& rhs) const; . bool operator! (const char* rhs) const; . friend ostream& operator (istream& is, MyString& str); /I stream extraction operat ) adeition operator iI addition operator 11 addition operator II addition assignment operator II addition assignment operator /I addition assignment operator /I equal-to operator /I equal-to operator /I not-equal-to operator /I not-equal-to operator Mystring operator+ (const char rhs) const; Mystring operator+ (const Mystring& rhs) const; .MyString operator+ (const ca s Mystring& operator+ (const char rhs): Mystring& operator+-(const char* rhs), . bool operator(const char* rhs) const; . bool operator! (const char* rhs) const; Mystrings operator*-(const Mystring& rhs); . bool operator (const MyString& rhs) const; .bool operator! (const MyString& rhs) const; friend ostream&operator (istreamk is, MyString& str); /I stream extraction operator You are provided with three startup files: /home/cmpsc122/s19/hw3/mystring.h home/cmpsc122/s19/hw3/mystring.cxx /home/cmpsc122/s19/hw3/testmystring.cxx mystring.h has the class declaration, mystring.cxx has the implementation of member functions and operators, and testmystring.cxx has the main program that tests your MyString class. In this assignment, you have to complete the implementation of the member functions and operators in mystring.cxx. Do not change any code in mystring.h and testmystring.cxx. To compile and run the program, use the following commands: g++ -ansi -pedantic -Wall mystring.cxx testmystring.cxx- testaystring s./testmystring If you pass all tests in testmystring.cxx, the following messages will be printed at the end of its output Congratulation! Your program passed all 30 test cases. Otherwise, the program will output the number of test cases your program failed. MyString class In this assignment, you are to create MyString class that supports custom operators, such as addition, equality, and stream insertion and extraction. Following describes the member functions and operators of the Mystring class: .MyString() MyString(const char* src); .MyString); MyString(const char src); MyString(const MyString& src): /I default constructor II constructor: creating a string from a char II constructor: creating a string from C-string II copy constructor /I destructor int Getlength() const; char GetCharAt (int index) const; void SetCharAt (int index, char ch) const; /I getter /I getter II setter . MyString& operators (const char rhs); . MyString& operator- (const char* rhs); /I copy assignment operator 11 copy assignment operator MyString& operator (const MyString& rhs); / copy assignmsent operator /1 addition operator 11 addition operator . MyString operator+ (const char rhs) const; MyString operator+ (const chan* rhs) const; MyString operator+ (const MyString& rhs) const; II addition operator .MyStrin& operator (const char rhs); Mystring& operator+-(const char* rhs); MyString& operator-(const MyString& rhs); bool operator (const MyString& rhs) const; bool operator (const char rhs) const; bool operator!-(const MyStrings rhs) const bool operator! (const char* rhs) const; friend ostreans operatorc (ostreans os, const Mystrings str):// stream insertion operator friend istrean& operator (istream is, Mystrings str): /I addition assignment operator /I addition assignment operator /l addition assignment operator // equal-to operator // equal-to operator /I not-equal-to operator /I not-equal-to operator 1/ strean extraction operator You are provided with three startup files: /home/cmpsc122/s19/hw3/mystring.h /hone/cmpsc122/s19/hw3/mystring.cxx /home/cmpsc122/s19/hws/testmystring.cxx mystring.h has the class declaration, mystring.cxx has the implementation of member functions and operators, and testmystring.cxx has the main program that tests your MyString class. In this assignment, you have to complete the implementation of the member functions and operators in mystring.cxx. Do not change any code in mystring.h and testmystring.cxx. To compile and run the program, use the following commands s g+ -ansi -pedantic -wall mystring.cxx testmystring.cxx- testmystring s ./testmystring you pass all tests in testmystring.cxx, the following messages will be printed at the end of its output. Congratulation! Your program passed all 30 test cases. therwise, the program will output the number of test cases your program failed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions