#ifndef _PLACE_H #define _PLACE_H #include #include "CPstring.h" static const double MINUTES_IN_DEGREE = 60.; // # of Minutes in a degree static const double SECONDS_IN_MINUTE = 60.; // # of seconds in minute // // Place 12/96 for CPS100E // // Place: A Record for Geography database // // // Place(); -- constructors // Place (int stateID, int ID, string name, PlaceType type, // string state, int population, int housing, // int landArea, int waterArea, // double latitude, double longitude); // // Retrieval functions all are const // // int GetID () -- returns ID # of place // string GetState() -- returns name of state // void GetState(string & state, int ID) -- returns state and state ID // string GetName() -- returns name of place // int GetLandArea() -- returns land area of place // int GetWaterArea() -- returns water area of place // void GetCoordinates (double & latitude -- returns coordinates of place // double & longitude) // PlaceType GetPlaceType() -- Returns place type // // Output operations: // Print(ostream & out) const -- prints out the place // friend ostream & operator<< -- << operator // (ostream & o, const Place & place) // // friend int operator == const Place &p1, const Place & p2) equality operator class Place { public: static const int NO_ID; enum PlaceType { NO_TYPE, CITY, TOWN, BOROUGH, VILLAGE, CDP }; Place(); // Default Constrcutor Place (int stateID, int ID, string name, PlaceType type, //constructor string state, int population, int housing, int landArea, int waterArea, double latitude, double longitude); int GetID() const; // place ID string GetState () const; // state name void GetState (string & state, int & ID) const; // state string GetName () const; // name of place int GetLandArea() const; // land area of place int GetWaterArea() const; // water area of place void GetCoordinates (double & latitude, double & longitude) const; PlaceType GetPlaceType() const; // kind of town, city void Print (ostream & out) const; private: int myStateID; // id # of state int myID; // id # of place string myName; // name of place PlaceType myType; // type of place (city, town, village) string myState; // 2 letter state abbreviation int myPop; // population int myHousing; // Housing units int myLandArea; // land area (in thousands of square meters) int myWaterArea; // water area (in thousands of square meters) double myLatitude; // latitude 10^6 Units = 1 degree // >0 North <0 South double myLongitude; // longitude 10^6 Units = 1 degree // >0 East <0 West }; ostream& operator<<(ostream& o, const Place & place); inline bool operator ==(const Place & p1, const Place & p2) { return (p1.GetName()==p2.GetName() && p1.GetState()==p2.GetState()); } #endif