Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++Programming Find in Homework 3 Write a String class which will be a wrapper class to the C style strings. The strings will be of

image text in transcribedimage text in transcribedimage text in transcribed

C++Programming Find in Homework 3 Write a String class which will be a wrapper class to the C style strings. The strings will be of varying logical lengths, but will have a fixed physical (maximum) length of MAXLEN (defined to be 128 characters) (30 points) Your String class must implement all the appropriate methods including constructors assignment, equality operators, the index operator |, reverse, indexOf (find), print, and read. About four public methods should check MAXLEN to see if the physical capacity has been exceeded (read, String(char *), operator +, operator +=). If so, print an error message and do something reasonable to recover so the program can continue running (30 points) Do not use any of the C str functions (e.g. strcmp, strlen, strcat, or strcpy), however write them yourself, as static methods, then use your static methods. REMEMBER: never copy/paste code from any source you must write everything yourself. These str functions should not check MAXLEN and we will reuse them in HW4 File organization: Create a directory with your UCI Net ID for the file name. Put all your .cpp .h and Makefile in this file. Put the full definition of class String in a file named String.h. Put your main program and testing functions in a file named string-test.cpp. String-test.cpp must #include String.h. You can compile your program with the comand g++ string_test.cpp -o string_test. You can run it by calling string_test. Before you submit your homework, zip the entire directory named with your UCI Net ID and submit that to dropbox. Submit your PDF report to gradescope Class String declaration: . . . #de fine MALEN 128 class String public: /17 Both constructors should construct this String from the parameter s explicit String( const char * s = ""); String const String & S) String operator = ( const String & s ); char & operator [ ( int index ); int size ()

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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

Lab Manual For Database Development

Authors: Rachelle Reese

1st Custom Edition

1256741736, 978-1256741732

More Books

Students also viewed these Databases questions

Question

Is conflict always unhealthy? Why or why not? (Objective 4)

Answered: 1 week ago