Assignment #5, COP-3337

Implement some improvements and extensions to the String class. Items with * are extra credit. This assignment is due at the start of class, Feb 20. Start early; this assignment is substantial.

Required Improvements

You must implement the following improvements:
  1. Add a data member to store the current string length, thus avoiding repeated calls to strlen for []. (Exercise 2.33 (a)).
  2. Add operator+ and operator+= to perform string concatentation with a String as parameter. Watch out for aliasing in the += case. (Exercise 2.33 (c)).
  3. Improve operator+= that is written with a char as parameter. If the String is full, double the capacity, so that repeated calls to += do not require repeated array expansion.
  4. Add operator* and operator*= to expand into multiple copies. (Exercise 2.33 (d)).
  5. Add the LowerCase and UpperCase member functions. (Exercise 2.33 (f)).
  6. Implement a SubString member function. You may not use repeated calls to operator+= to do it.
  7. * Overload operator(), with two parameters, and have it call SubString.
  8. * Define friend functions for the six relational/equality operators that take a const char * as the first parameter and a String as the second parameter. Also define member functions for the six relational/equality operators that take a const char * as a parameter. This is in addition to the six relational/equality member functions that are already defined (and take a String as a parameter).

What To Submit

You must write a program that tests your String class extensively. Part of your grade will be based on how exhaustive your testing is. Submit the test program, and your complete String class, along with sample output.