// **************************************************** // Header file sphereClass.h for the class sphereClass. // **************************************************** #ifndef sphereClass_h /* To prevent multiple inclusion problems */ #define sphereClass_h const double PI = 3.14159; class sphereClass { public: sphereClass(); // Default constructor: Creates a sphere and // initializes its radius to a default value. // Precondition: None. // Postcondition: A sphere of radius 1 exists. sphereClass(double initialRadius); // Constructor: Creates a sphere and initializes // its radius. // Precondition: initialRadius is the desired // radius. // Postcondition: A sphere of radius initialRadius // exists. void SetRadius(double newRadius); // Sets (alters) the radius of an existing sphere. // Precondition: newRadius is the desired radius. // Postcondition: The sphere's radius is newRadius. double Radius() const; // Determines a sphere's radius. // Precondition: None. // Postcondition: Returns the radius. double Diameter() const; // Determines a sphere's diameter. // Precondition: None. // Postcondition: Returns the diameter. double Circumference() const; // Determines a sphere's circumference. // Precondition: PI is a named constant. // Postcondition: Returns the circumference. double Area() const; // Determines a sphere's surface area. // Precondition: PI is a named constant. // Postcondition: Returns the surface area. double Volume() const; // Determines a sphere's volume. // Precondition: PI is a named constant. // Postcondition: Returns the volume. void DisplayStatistics() const; // Displays statistics of a sphere. // Precondition: None. // Postcondition: Displays the radius, diameter, // circumference, area, and volume. private: double theRadius; // the sphere's radius }; // end class #endif