// Chap 3, pp 123 - 125
// Change the name of this file to Sphere.h
// ***************************************************
// Header file Sphere.h for the class sphereClass.
// ***************************************************
const double PI = 3.14159;
class sphereClass
{
public:
sphereClass(double R);
// ------------------------------------------------
// Constructor: Initializes a sphere and
// its radius.
// Precondition: R is the desired radius.
// Postcondition: TheRadius is set to R.
// ------------------------------------------------
sphereClass();
// ------------------------------------------------
// Default constructor: Initializes a sphere and
// its radius to a default value.
// Precondition: None.
// Postcondition: TheRadius is set to 1.
// ------------------------------------------------
sphereClass(const sphereClass& S);
// ------------------------------------------------
// Copy constructor: Creates a copy of a sphere.
// Precondition: S is a sphere.
// Postcondition: A copy of S is created.
// ------------------------------------------------
~sphereClass();
// Destructor: Destroys a sphere.
// Precondition: The constructor has been called.
// Postcondition: The sphere is deallocated.
// ------------------------------------------------
double Radius();
// ------------------------------------------------
// Determines a sphere's radius.
// Precondition: The constructor has been called.
// Postcondition: Returns the radius.
// ------------------------------------------------
void SetRadius(double R);
// ------------------------------------------------
// Sets (alters) the radius of an existing sphere.
// Precondition: The constructor has been called.
// R is the desired radius.
// Postcondition: TheRadius is set to R.
// ------------------------------------------------
double Diameter();
// ------------------------------------------------
// Determines a sphere's diameter.
// Precondition: The constructor has been called.
// Postcondition: Returns the diameter.
// ------------------------------------------------
double Circumference();
// ------------------------------------------------
// Determines a sphere's circumference.
// Precondition: The constructor has been called.
// PI is a named constant.
// Postcondition: Returns the circumference.
// ------------------------------------------------
double Area();
// ------------------------------------------------
// Determines a sphere's surface area.
// Precondition: The constructor has been called.
// PI is a global constant.
// Postcondition: Returns the area.
// ------------------------------------------------
double Volume();
// ------------------------------------------------
// Determines a sphere's volume.
// Precondition: The constructor has been called.
// PI is a global constant.
// Postcondition: Returns the volume.
// ------------------------------------------------
void DisplayStatistics();
// ------------------------------------------------
// Displays statistics of a sphere.
// Precondition: The constructor has been called.
// Postcondition: Displays the radius, diameter,
// circumference, area, and volume.
// ------------------------------------------------
private:
double TheRadius; // the sphere's radius
}; // end class
               (
geocities.com/siliconvalley/program/2864/ds)                   (
geocities.com/siliconvalley/program/2864)                   (
geocities.com/siliconvalley/program)                   (
geocities.com/siliconvalley)