|
Sphere Class Reference#include <Sphere.h>
List of all members.
Detailed Description
Definition of a class of Spheres.
Definition at line 22 of file Sphere.h.
Constructor & Destructor Documentation
|
Default constructor: Creates a Sphere and initializes its radius to a default value. - Precondition:
- None.
- Postcondition:
- A Sphere of radius 1 exists.
Definition at line 23 of file Sphere.cpp. |
Sphere::Sphere |
( |
double |
initialRadius |
) |
|
|
|
Constructor: Creates a Sphere and initializes its radius. - Precondition:
- initialRadius is the desired radius.
- Postcondition:
- A Sphere of radius initialRadius exists.
- Parameters:
-
| initialRadius | The given radius. |
Definition at line 27 of file Sphere.cpp.
References theRadius. |
Member Function Documentation
void Sphere::setRadius |
( |
double |
newRadius |
) |
|
|
|
Sets (alters) the radius of an existing Sphere. - Precondition:
- newRadius is the desired radius.
- Postcondition:
- The Sphere's radius is newRadius.
- Parameters:
-
| newRadius | The new radius. |
Definition at line 35 of file Sphere.cpp.
References theRadius.
Referenced by main(). |
double Sphere::getRadius |
( |
|
) |
const |
|
double Sphere::getDiameter |
( |
|
) |
const |
|
double Sphere::getCircumference |
( |
|
) |
const |
|
|
Determines a Sphere's circumference. - Precondition:
- PI is a named constant.
- Postcondition:
- None.
- Returns:
- The circumference.
Definition at line 53 of file Sphere.cpp.
References getDiameter(), and PI.
Referenced by displayStatistics(). |
double Sphere::getArea |
( |
|
) |
const |
|
|
Determines a Sphere's surface area. - Precondition:
- PI is a named constant.
- Postcondition:
- None.
- Returns:
- The surface area.
Definition at line 58 of file Sphere.cpp.
References PI, and theRadius.
Referenced by displayStatistics(). |
double Sphere::getVolume |
( |
|
) |
const |
|
|
Determines a Sphere's volume. - Precondition:
- PI is a named constant.
- Postcondition:
- None.
- Returns:
- The volume.
Definition at line 63 of file Sphere.cpp.
References PI, and theRadius.
Referenced by displayStatistics(). |
void Sphere::displayStatistics |
( |
|
) |
const |
|
Member Data Documentation
The documentation for this class was generated from the following files:
|