Question: Proof My Code Please--Do in Java /*What happens in a universe where Newton's second law does not apply? This situation would correspond to forceTo() in

Proof My Code Please--Do in Java

/*What happens in a universe where Newton's second law does not apply? This situation would correspond to forceTo() in Body always returning the zero vector. */ public class NewtonsSecondLawModification { private Vector r; private Vector v; private final double mass; public Body(Vector r0, Vector v0, double m0) { r = r0; v = v0; mass = m0; } public void move(Vector force, double dt){ Vector a = force.scale(1/mass); v = v.plus(a.scale(dt)); r = r.plus(v.scale(dt)); } public Vector forceFrom(Body b){ //Compute force ont his body from b. Body a = this; double G = 6.67e-11; Vector delta = b.r.minus(a.r); double dist = delta.magnitude(); double magnitude = (G * a.mass * b.mass / (dist * dist)); Vector force = delta.direction().scale(magnitude); return force; } public vod draw(){ StdDraw.setPenRadius(0.0125); StdDraw.point(r.cartesian(0), r.cartesian(1)); } }

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!