c++ Project 6: Buoyancy. Buoyancy is the ability of an object to float. Archimedes’ principle states that the buoyant force is equal to the weight of the fluid that is displaced by the submerged object. The buoyant force can be computed by Fb = V × y where Fb is the buoyant force, V is the volume of the submerged object, and y is the specific weight of the fluid. If Fb is greater than or equal to the weight of the object, then it will float, otherwise it will sink. Write a program that inputs the weight (in pounds) and radius (in feet) of a sphere and outputs whether the sphere will sink or float in water. Use y = 62.4 lb/cubic feet as the specific weight of water. The volume of a sphere is computed by (4/3)π(r cubed).

Respuesta :

Answer:

Following is C++ program to check the buoyancy of sphere:

#include <stdio.h>

#include <iostream>

using namespace std;

int main()

{

double radius, weight, fb, vol, y = 62.4;

cout<<"Enter the weight of sphere"<<endl;

cin>>weight;

cout<<"Enter the radius of sphere"<<endl;

cin>>radius;

vol = (4/3)*3.14*radius*radius*radius;

fb = vol*y;

if(fb>=weight)

 cout<<"Sphere will float"<<endl;

else

 cout<<"Sphere will sink"<<endl;

 

return 0;

}

Output:

Enter the weight of sphere

545.63

Enter the radius of sphere

5

Sphere will float

Explanation:

The program will ask the user to input weight and radius of sphere. Using the value of radius the program will calculate the volume of sphere as per given formula. And using the volume it will next calculate the buoyant force.

Then using if condition the program will check the obtained buoyant force is grater than the weight of object to know if it will float or not.

In this exercise we have to use the knowledge in computational language in C++ to write the following code:

We have the code can be found in the attached image.

So in an easier way we have that the code is:

#include <stdio.h>

#include <iostream>

using namespace std;

int main()

{

double radius, weight, fb, vol, y = 62.4;

cout<<"Enter the weight of sphere"<<endl;

cin>>weight;

cout<<"Enter the radius of sphere"<<endl;

cin>>radius;

vol = (4/3)*3.14*radius*radius*radius;

fb = vol*y;

if(fb>=weight)

cout<<"Sphere will float"<<endl;

else

cout<<"Sphere will sink"<<endl;

return 0;

}

See more about C++ at brainly.com/question/19705654

Ver imagen lhmarianateixeira