Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Implement the Text ADT (use the declaration in the Text.h file) (40 points) - Text(), operator=() and ~Text(), getLength(), clear(), operator[] #ifndef TEXT_H #define TEXT_H

Implement the Text ADT (use the declaration in the Text.h file) (40 points)

- Text(), operator=() and ~Text(), getLength(), clear(), operator[]

#ifndef TEXT_H #define TEXT_H

#include #include

using namespace std;

class Text { public:

// Constructors and operator= Text ( const char *charSeq = "" ); // Initialize using char* Text ( const Text &other ); // Copy constructor void operator = ( const Text &other ); // Assignment

// Destructor ~Text ();

// Text operations int getLength () const; // # characters char operator [] ( int n ) const; // Subscript void clear (); // Clear string

// Output the string structure -- used in testing/debugging void showStructure () const;

//-------------------------------------------------------------------- // In-lab operations // toUpper/toLower operations (Programming Exercise 2) Text toUpper( ) const; // Create upper-case copy Text toLower( ) const; // Create lower-case copy

// Relational operations (Programming Exercise 3) bool operator == ( const Text& other ) const; bool operator < ( const Text& other ) const; bool operator > ( const Text& other ) const;

private:

// Data members int bufferSize; // Size of the string buffer char *buffer; // Text buffer containing a null-terminated sequence of characters

// Friends

// Text input/output operations (In-lab Exercise 1) friend istream & operator >> ( istream& input, Text& inputText ); friend ostream & operator << ( ostream& output, const Text& outputText );

};

#endif

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

Step: 3

blur-text-image

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

More Books

Students also viewed these Databases questions