Question: C++ For this assignment you will be measuring the gravitational attraction between two spheres at different distances. Your program will prompt the user to enter

C++

For this assignment you will be measuring the gravitational attraction between two spheres at different distances. Your program will prompt the user to enter the mass and radius of each sphere (r1,r2,m1,m2). It will then prompt user for the distance x between the two spheres (edge to edge). To calculate the force, use F=(m1m2/d2) G, where G=6.67408e-11 and d=(x+r1+r2). Mass will be entered in KG and distances in meters. Display the distance and force in a table format. Continuously subtract 1/20th of the original value of x from the distance, recalculating the force and displaying both. Verify all inputs by checking that the values are greater than zero. If the user enters a negative value, display an error message and prompt the user to reenter the value.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!