Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++ homework; This is a two-part problem, please leave comments under // 1) The gravitational attractive force F between two bodies with masses m1 and
C++ homework;
This is a two-part problem, please leave comments under //
1) The gravitational attractive force F between two bodies with masses m1 and m2 separated by a center-to-center distance r is given by the following formula Gm1m2 m.x Where G is the universal gravitational constant G-6.67384 x 10-11 Write a function that takes arguments for the masses of the two bodies and the distance between them and returns the gravitational force between them. You should use a locally defined constant variable G for the universal gravitational constant G. Test your function to find the gravitational force with the earth moon data below xample data Mearth 5.97219 x 104 kg Mmoon 7.34767x 102 kg Earth-moon distance (average) 363104 x 103 m F2.22 x 1020 N Use the earth moon data to verify your function 2"d part: Now improve your program by embedding your function in a complete program that asks the user to enter input for the masses and separation distance, and then calls your function to compute this. Finally, your program should allow the user to repeat this calculation as many times as they wishStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started