//Alexnader Sage //Date 11/13/11 //Hw6 //Purpose: to use an input radius and weight to decide whether or not the sphere floats #include <iostream> #include <math.h> //making sure I can use the proper equations using namespace std; int main() { double V, r; // The volume and radius of the sphere static double d = 62.4; //density of water static double pi = 3.14159; double Fb, Fg; // Fb is the force of boyance and Fg is the weight of the object cout << "What is the radius of the sphere in feet, \n"; cout << "and the mass of the sphere in pounds\n"; cin >> r >> Fg; //cout << r << "\n"; //cout << Fg << "\n"; V = (4.0*pi*pow(r,3))/3.0; // volume of the sphere Fb = V*d; // force of boyance of the water onto the sphere if ((Fg - Fb) > 0) // gravity is stronger than the force of boyance cout << "The sphere will sink in water\n"; else if ((Fg - Fb) <= 0) //The object isn't dense enough to sink cout << "The sphere will float on the water\n"; return 0; }