Question
You are to create your own version of a string class named myString. myString will store a character string of up to 25 characters (how
You are to create your own version of a string class named myString.
myString will store a character string of up to 25 characters (how will you handle more than 25?).
The “string” of characters must be stored in a linked list. You will also need to supply the following methods as part of your class include a reference “status variable” for errors:
size() – returns how many characters are in the string (empty string is size zero)
addStart(myString) – will add the string in the input parameter to the front of current string (cannot exceed 25)
addEnd(myString) – will add the string in the input parameter to the end of the current string (cannot exceed 25)
partString(startPos, length) – returns string from startPos for length given (handle startPos < 0, startPos = size returns null string, handle startPos > size)
replPartString(myString, startPos) – replaces charaters starting at startPos with input string – (what if exceeds 25?)
replWholeString (myString) – replaces what is currently in string with input parameter string
compareString(myString) – compare current value of string with input parameter string.
initString() – resets/initializes string to null string
setString(string) – assign string to myString data value
getString() – returns string of data from myString data value
printStringScreen() – prints myString data value to the monitor
numericString() – is the string an integer or real (signs, decimal point. etc.)
alphabeticString() – is the string all alpabetic characters
You may use the C++ string class only for screen input and the setString method.
Write a main that will test all of the functionalities of the myString class displaying the actions on the screen and an output file. The main should use a method to write out the results to the file.
Output file log of actions must show action, original value of myString, parameters/results, success/error message.
You determine format and error messages – format into columns for readability
Step by Step Solution
3.40 Rating (163 Votes )
There are 3 Steps involved in it
Step: 1
include include using namespace std int count0 public ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started