/* Sphere.h provides a Sphere class, 
 * that illustrates the use of class methods.
 * By: Joel C. Adams, Summer 2001.
 * For: C++ An Introduction to Computing 3/e.
 *******************************************************************/

#include <cassert>    // assert()
#include <cmath>      // pow()
using namespace std;

const double PI = 3.14159;

class Sphere
{
 public:
   Sphere();
   // ... other Sphere instance method prototypes ...
   
   static double computeWeight(double radius, double density);
   static double computeDensity(double radius, double weight);
   static double computeRadius(double density, double weight);

 private:
   // ... instance variable declarations omitted ...
};

inline double Sphere::computeWeight(double radius, double density)
{
   if (radius > 0 && density > 0)
      return density * 4.0 * PI * pow(radius, 3) / 3.0;
   else
      return 0.0;
}

// ... other Sphere class methods left as exercises ...
