/*********************************************************************
Scott Morgan
CSCI 151
Dev C++ Compiler
This program will accept as input the length of the side of a cube
Based on that input, the radius of the sphere, the volume of a cube,
the surface area of a cube, volume of the sphere, the surface area
of a sphere, and the Volume Between the cube and the sphere will be
calculated. The results will be output to the screen.
*********************************************************************/
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
// declare a named constant for PI
const double PI = 3.1415926;
int main()
{
// declare variables
char char1;
double radius_sphere;
double volume_cube;
double surface_area_cube;
double sphere_volume;
double sphere_surface_area;
double volume_between;
double side;
// what this program is about
cout << "**************************************************************************" << endl;
cout << "* This program will accept as input the length of the side of a cube *" << endl;
cout << "* Based on that input, the radius of the sphere, the volume of a cube, *" << endl;
cout << "* the surface area of a cube, volume of the sphere, the surface area *" << endl;
cout << "* of a sphere, and the Volume Between the cube and the sphere will be *" << endl;
cout << "* calculated. The results will be output to the screen. *" << endl;
cout << "* *" << endl;
cout << "* Thanks and Enjoy! *" << endl;
cout << "* Tips and Donations are accepted! *" << endl;
cout << "* Program Designed by Scott Morgan *" << endl;
cout << "**************************************************************************" << endl;
system("pause"); // we all need time to read
system("cls") ; // no need in cluttering up the screen
// got to get the length of the cube sides
cout << "Please enter the length of the sides of the cube and press enter. ";
cin >> side;
system("cls"); //again no need for garbage on the screen
// got to get the length of the cube sides
cout << "Please enter the length of the sides of the cube and press enter. ";
cin >> side;
// never was good at math
radius_sphere = side / 2;
volume_cube = pow(side,3);
surface_area_cube = 6 * pow(side,2);
sphere_volume = 4.0 / 3.0 * PI * pow(radius_sphere,3);
sphere_surface_area = 4.0 * PI * pow(radius_sphere,2);
volume_between = volume_cube - sphere_volume;
// gotta show them decimals
cout << fixed << showpoint;
// lets see how many decimal points do we want today?
cout << setprecision(3);
cout << endl << endl;
// output results
cout << "*********************************************************************" << endl;
cout << " SURVEY SAYS! " << endl;
cout << "*********************************************************************" << endl;
cout << left << setw(20) << "The Side Length is" << right << setw(35) << side << " inches" << endl;
cout << left << setw(20) << "Radius of Sphere" << right << setw(35) << radius_sphere << " inches" << endl;
cout << left << setw(20) << "Volume of Cube" << right << setw(35) << volume_cube << " cubic inches" << endl;
cout << left << setw(20) << "Surface Area of Cube" << right << setw(35) << surface_area_cube << " square inches" << endl;
cout << left << setw(20) << "Volume of Sphere" << right << setw(35) << sphere_volume << " cubic inches"<< endl;
cout << left << setw(20) << "Sphere Surface Area" << right << setw(35) << sphere_surface_area << " square inches"<< endl;
cout << left << setw(20) << "Volume Between The Cube and The Sphere" << right << setw(17) << volume_between << " cubic inches"<< endl;
cout << "*********************************************************************" << endl;
cout << " THANK YOU FOR PLAYING! " << endl;
cout << "*********************************************************************" << endl;
system("pause");
return 0;
}