QUESTION IMAGE
Question
compute the acceleration of gravity for a given distance from the earths center, distcenter, assigning the result to accelgravity. the expression for the acceleration of gravity is: (g m) / (d^2), where g is the gravitational constant 6.673 x 10^-11, m is the mass of the earth 5.98 x 10^24 (in kg) and d is the distance in meters from the earths center (stored in variable distcenter). note: assume distance is at least the radius of the earth. see how to use zybooks for info on how our automated program grader works. 1 import java.util.scanner; 2 public class gravitycalculation { 3 public static void main(string args) { 4 scanner scnr = new scanner(system.in); 5 double g = 6.673e-11; 6 double m = 5.98e24; 7 double accelgravity; 8 double distcenter; 9 10 distcenter = scnr.nextdouble(); 11 12 / your solution goes here */ 13 14 system.out.println(accelgravity); 15 }
Step1: Define the formula
The formula for acceleration of gravity is $accelGravity=\frac{G * M}{distCenter^{2}}$.
Step2: Implement in Java
In the given Java code, add the line accelGravity = (G M) / (distCenter distCenter); at line 12.
Snap & solve any problem in the app
Get step-by-step solutions on Sovi AI
Photo-based solutions with guided steps
Explore more problems and detailed explanations
Add the following line at line 12: accelGravity = (G M) / (distCenter distCenter);