189k views
5 votes
Newton's law states that the force, F, between two bodies of masses M1 and M2 is given by: F=k(d2M1M2), in which k is the gravitational constant and d is the distance between the bodies. The value of k is approximately 6.67×10−8dyn.cm2/g2. Write a program that prompts the user to input the masses of the bodies and the distance between the bodies. The program then outputs the force between the bodies. a. Make flow-chart and pseudo-code of the problem

1 Answer

6 votes

Final answer:

This problem involves creating a program that uses Newton's law of gravitation to calculate the force between two bodies, given their masses and the distance between them. A flowchart and pseudo-code are needed to outline the program's logic.

Step-by-step explanation:

The question involves using Newton's law of gravitation to write a program that calculates the gravitational force between two bodies with given masses and a specified distance between them. According to Newton's universal law of gravitation, every mass attracts every other mass with a force that is proportional to the product of their masses and inversely proportional to the square of the distance between them. The formula used is F = G * (M1 * M2) / d^2, where F represents the gravitational force, M1 and M2 are the masses of the two bodies, d is the distance between their centers of mass, and G is the universal gravitational constant.

To solve this problem, one must:

  1. Identify the masses of the two bodies (M1 and M2).
  2. Measure the distance between the centers of mass of the two bodies (d).
  3. Calculate the force using Newton's gravitational formula.

This process requires creating a flowchart and pseudo-code to structure the program logic before writing the actual code.

User Daniel Wedlund
by
8.1k points