Project 3 - MyString Class
Due Date:
Tuesday, July 19 (11:59PM)
OR
Friday, July 22 (11:59PM) *
*If student attends their scheduled recitations (or another makeup time)
between now and July 22. For the week of July 4th, students in the
Monday recitation must either attend Wednesday's recitation or an office
hours to qualify.
This project will count double!
Objective
This assignment will give you practice working with c-strings, algorithm design, dynamic memory allocation, overloading various operators, and copy constructor / assignment operator.
Task
You will provide an implementation for the MyString class that stores and performs various operations with a string. In addition, you will provide a driver that tests each function in said implementation. A complete header file, a skeleton implementation file and an empty driver file have been provided for you :
Students should not change MyString.h in any way. Submissions will be tested using the MyString.h above.
The skeleton implementation file contains detailed descriptions of each of the functions. Students should implement each function as described in the comments of MyString.cpp. Students may use functions in the c++ standard libraries (most, if not all, functions needed should be referenced in the function descriptions) in their implementations but may NOT use the String class.
In addition to the completed implementation file, students must also turn in a driver file which tests the complete functionality of their implementation. Your tests should be simple but should also prove the correctness of your solution. The driver file should be well commented indicating where each feature is tested and the expected output.
Approach
Although this project is a bit longer than previous projects, the approach is very well defined. Here are the steps to successfully completing the MyString project:
- Look over MyString.h to get an overview of what the MyString class looks like. Don't worry about the tokenization and substring generation member data yet.
- Review the function descriptions in MyString.cpp. It is not necessary to know how to implement each function yet, just get an idea of the input/output parameters and the general purpose of the function.
- Start filling in the function definitions:
- Start from the top of MyString.cpp -- I have ordered the functions you must implement in the order I think is most intuitive.
- Ignore anything related tokeniztion or substring generation until you implement the tokenization and substring generation utility routines. You may then come back and alter other routines to properly handle these sections of the member data.
- After you implement each routine. Write your test case in driver.cpp and test that routine!!! This is the best time to write your test cases as you have just read the function requirements! Your test cases (driver.cpp) will count as 25% of this project, if you follow any direction, make it this one ;-)
- Test your routine, fix bugs. Go to recitation, office hours, lecture and email your TAs with pointed questions. Also, you will find other victims (students) in the Computer Science Majors lab that you may commiserate with (Just remember to NEVER share code).
- Repeat until all functions implemented
General Requirements:
- Your code MUST compile on linprog using the command 'g++ MyString.cpp driver.cpp -Wall' and produce no compiler errors OR warnings!
- No using the c++ String class
- No global variables, other than constants
- When you write source code, it should be readable and well-documented.
For this project, submit the following files via PyGrader:
MyString.cpp
driver.cpp