#ifndef BALZIP_H #define BALZIP_H // balzip.h Interface file for the BALZip class /******************************************************************************* // MODULE NAME: BALZip // INTERFACE FILE: balzip.h // IMPLEMENTATION FILE: balzip.cpp // // PURPOSE: To provide a BALZip type useful in an implementation of the BAL // program that allows the user to create a new object, change the value of the // zip code stored in the object, test the object to see if it contains a valid // or default value, print the current or default contents of the object, and // change the contents of the object to the default value // // FUNCTIONS: Name Purpose // BALZip Parameterless Constructor // isValid Test if it contains a valid zip code // isDefault See if it contains the default value // Print Print the current value of the object // Default Print the default value of the object // Limits Print the limits on the object // valueIs Print the current value of the object // Store Change the value to a new one // Reset Change the value to the default // // AUTHOR: Amy Langill *2B DATE: 3/20/1999 *******************************************************************************/ #include // for isdigit #include // for strings using namespace std; const int ZIP_WIDTH=5; // Width of a zip field const string DEFAULT_ZIP="99999"; // Default value const char ZIP_STRING_FILLER=' '; // For formatting output const int FIRST_DIGIT=0; // 1st position in a zip code class BALZip { public: // Constructors BALZip(); // Observers bool isValid(); bool isDefault(); string valueIs(); string Print(); string Default(); string Limits(); // Transformers void Store(string newZip); void Reset(); private: string value; }; #endif