C++ homework about strings | Computer Science homework help
1.The program must compile with clang++
2.This website has the solution and all the files to help you in making the program:
https://github.com/ChristopherJones72521/CS23001-KentState/tree/master/Projects/String
but the problem is what I’m asking for my assignment is only part one of the program which I have listed below and the website has additional parts and requirements, so if you can figure out which part to take from the website from each file and which part to leave that would be great, and you dont have to write new files from the scratch.
I’ve uploaded a zip file with all the files our instructor gave us and feel free to make new files if needed but you sholud work as the file required.
Here’s what I need:
Objectives:
-Use a well developed ADT class which utilizes operator overloading.
-Use dynamically allocated arrays.
Problem:
The Apache web server produces information detailing web page accesses, this information is stored in a log file in the Apache Common log file format. The assignment is to develop a program to process this log file and keep track of the different types of log entries.
Requirements:
- You CANNOT use the C++ standard string or any other libraries for this assignment, except where specified.
- You must use your ADT string for the later parts of the assignment.
using namespace std;
is stricly forbiden. As are any globalusing
statements.- Name the folder for this project:
string
(please use all lower case letters). - Milestone 1 (25pts)
- Implementation:
- Create an ADT
String
using the class construct. It will be a NULL (zero) terminating charater array. - Note: C++ has a standard type called
string
so you should not use this name. UseString
instead. - Please name all your files using only lower case letters.
- Use the provided specification (svn/shared/project2/string-mile1.hpp) for naming your class and methods You should rename this to string.hpp. A test suite will be provided in Part 2 that uses this interface to test your string class.
- You should use a fixed sized array of
char
for storage with a max capacity based on a constantconst int STRING_SIZE = 256;
This array will store the characters along with the NULL (0) terminator. - Implement the constructor functions (i.e., for char[] and char).
- Overload + and += as concatenation (make sure they works for all variations string + string, string + char[], char[] + string, etc).
- Overload all the relational operators (==, <, >, etc.).
- Implement the methods:
operator[](int)
– both accessor and modifier versionslength()
– returns number of characters in stringcapacity()
– returns the max number of characters that can be stored in the stringsubstr(int start, int end)
– returns the sub string from start to end position (inclusive)findch(int pos, char ch)
– returns location of ch at or after posfindsstr(int pos, cosnt String& str)
– returns the location of str at or after pos- Overload both I/O operators – Input should read in one word at a time. The input operator for char[] works that way and can be used.
- Create an ADT
- Testing:
- Develop a set of test cases, using asserts, for each of the operators and methods of the
String
class. - Write test cases first. Testing must be thorough. You will be relying on the string to be correct.
- The command
make tests
will build and run the unit tests. - After each function passes a test, commit your work to svn with a message such as “Constructor tests passed”.
- Your string class will be tested on a set of cases developed by the instructors. You will be graded on how well you pass these tests. These tests cover the constructors, comparison, operator[], substr, findch, and the concatenation operator.
- Develop a set of test cases, using asserts, for each of the operators and methods of the
- Implementation:
Leave a Reply
Want to join the discussion?Feel free to contribute!