//********************************************************* // A tokenType object has two data members: a text field, // and an integer field. The object is intended to be used // in a program that prepares a word-frequency distribution // for a text file. The text field of a tokenType object // contains a word and the frequency field contains the // number of times the word appears in the text. //********************************************************* class tokenType { private: string text; int freq; public: //----------------------------------------------------- // Construct a default token whose text field is the // empty string and whose frequency is 0. //----------------------------------------------------- tokenType() { } //----------------------------------------------------- // Set this token's text and frequency to the specified // values. // // In Parameter: newText, newFreq // //----------------------------------------------------- void set(string newText, int newFreq) { } //----------------------------------------------------- // Return an unsigned integer based on the value of the // text in this token. //----------------------------------------------------- unsigned int hashcode() { } //----------------------------------------------------- // Return true if this token has the same key field // value as the specified token and false otherwise. // The key field of a token is the text component. // // In Parameter: tok //----------------------------------------------------- bool key_equal(tokenType tok) { } //----------------------------------------------------- // Add one to the frequency of this token. //----------------------------------------------------- void incrementFreq() { } //----------------------------------------------------- // Get this token's text. //----------------------------------------------------- string getText() { } //----------------------------------------------------- // Get this token's frequency. //----------------------------------------------------- int getFreq() { } //----------------------------------------------------- // Return true if this token is less than the // specified token and false otherwise. The comparison // is made on the basis of the key field values. // // In Parameter: rValue //----------------------------------------------------- bool operator < (const tokenType& rValue) { } //----------------------------------------------------- // Return true if this token equals the specified // token and false otherwise. Two tokens are equal // if they have the same key value. // // In Parameter: rValue //----------------------------------------------------- bool operator == (const tokenType& rValue) { } };