119k views
3 votes
Marius is writing a program that calculates physics formulas.

His procedure calcGravForce should return the gravitational force between two objects at a certain radius from each other, based on this formula:
F=G((m1m2)/r^2)
1 PROCEDURE calcGravForce (mass1, mass2, radius)
2 {
3 \,\,\,\,space, space, space, spaceG â 6.674 * POWER(10, â11)
4 \,\,\,\,space, space, space, spacemasses â mass1 * mass2
5 \,\,\,\,space, space, space, spaceforce â G * ( masses / POWER(radius, 2) )
6 }
The procedure is missing a return statement, however.
Part 1: Which line of code should the return statement be placed after?
After line 5
RETURN force
The following

1 Answer

1 vote

Final answer:

The force variable is calculated correctly in line 5, so adding the return statement after line 5 will ensure that the calculated force is returned as the result of the procedure.The return statement should be placed after line 5 in the calcGravForce procedure.

Step-by-step explanation:

The return statement should be placed after line 5 in the calcGravForce procedure.

The force variable is calculated correctly in line 5, so adding the return statement after line 5 will ensure that the calculated force is returned as the result of the procedure.

User Mangusbrother
by
4.1k points