// Chap 3, pp 127 -128
// Change the name of this file to Sphere.cpp
// *********************************************************
// Implementation file Sphere.cpp for the class sphereClass.
// *********************************************************
#include "Sphere.h" // header file
sphereClass::sphereClass(double R): TheRadius(R)
{
} // end constructor
sphereClass::sphereClass(): TheRadius(1.0)
{
} // end default constructor
sphereClass::sphereClass(const sphereClass& S): TheRadius(S.TheRadius)
{
} // end copy constructor
sphereClass::~sphereClass()
{
TheRadius = 0;
} // end destructor
void sphereClass::SetRadius(double R)
{
TheRadius = R;
} // end SetRadius
double sphereClass::Radius()
{
return TheRadius;
} // end Radius
double sphereClass::Diameter()
{
return 2.0 * TheRadius;
} // end Diameter
double sphereClass::Circumference()
{
return PI * Diameter();
} // end Circumference
double sphereClass::Area()
{
return 4.0 * PI * TheRadius * TheRadius;
} // end Area
double sphereClass::Volume()
{
double R = TheRadius;
return (4.0 * PI * R * R * R)/3.0;
} // end Volume
void sphereClass::DisplayStatistics()
{
cout << "\nRadius = " << Radius()
<< "\nDiameter = " << Diameter()
<< "\nCircumference = " << Circumference()
<< "\nArea = " << Area()
<< "\nVolume = " << Volume() << endl;
} // end DisplayStatistics
// End of implementation file
               (
geocities.com/siliconvalley/program/2864/ds)                   (
geocities.com/siliconvalley/program/2864)                   (
geocities.com/siliconvalley/program)                   (
geocities.com/siliconvalley)