I have to create a sphere class with the following attributes:

> 
> Write a class Sphere with the following properties:
> 
> 
> Private attributes: (1) X, Y, Z coordinates of the center (2)
>  Radius
> 
> 
> Accessor and mutator methods to  
> 
>  • Set and get the X, Y, and Z
>  coordinates  
> 
>  • Set and get the radius  
> 
>  • Get the volume and surface
>  area if a sphere.
> 
> 
> For a sphere,  
> 
>  Volume = 4πr3/3  
> 
>  Surface Area = 4πr2  
> 
>  Write a main
>  program to test the sphere class.
> 
> 
> 

I have never worked with classes before. I think I did this correctly. However, my output for my Volume and my Surface Area comes out really strange. Below is my program and my output.

**PROGRAM**

```
#define _USE_MATH_DEFINES
#include <cmath>
#include <iostream>

using namespace std;

class Sphere {
private:
    float X;
    float Y;
    float Z;
    float R;
    float Volume;
    float SurfaceArea;
public:
    float DefineCoordinates(float x, float y, float z);
    void DefineRadius(float radius);
    double GetVolume()
    {
        return (((4 * M_PI*pow(R, 3))) / 3);
    }
    double GetSurfaceArea()
    {
        return (4 * M_PI*pow(R, 2));
    }
    float GetX();
    float GetY();
    float GetZ();

};

float Sphere::GetX() {
    return X;
}

float Sphere::GetY() {
    return Y;
}

float Sphere::GetZ() {
    return Z;
}

float Sphere::DefineCoordinates(float x, float y, float z) {
    X = x;
    Y = y;
    Z = z;
    return 0;
}

void Sphere::DefineRadius(float radius) {
    R = radius;
}

int main() {
    float inputr, radius, x, y, z;
    Sphere sphere;
    double Volume = sphere.GetVolume();
    double SurfaceArea = sphere.GetSurfaceArea();
    char open = '(';
    char close = ')';
    char comma = ',';
    cout << "Please input the center of the sphere in the fashion (X,Y,Z) and press enter: ";
    cin >> open >> x >> comma >> y >> comma >> z >> close;
    cout << "Please define the radius of the sphere: ";
    cin >> inputr;
    sphere.DefineCoordinates(x, y, z);
    sphere.DefineRadius(inputr);
    cout << "This sphere has a center of (" << sphere.GetX() << ", " << sphere.GetY() << ", " << sphere.GetZ() << ")." << endl;
    cout << "This sphere has a radius of " << inputr << "." << endl;
    cout << "This computes to a volume of " << Volume << " units cubed, and a surface area of " << SurfaceArea << "." << endl;
}

```

**OUTPUT**
No matter what I input as radius, I will get:

> 
> This computes to a volume of -5.18547e+24 units cubed, and a surface
>  area of 1.4488e+17.
> 
> 
> 

What am I doing wrong?? Also, any other advice to clean up my class would be helpful!