Last active
March 9, 2019 16:05
-
-
Save vincentius15/42c5cdfe1e033d6452454f18e4191c25 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MovingObject { | |
private int initialVelocity; | |
private int duration; | |
private int acceleration; | |
private int mass; | |
public MovingObject(int initialVelocity, int duration, int acceleration, int mass) { | |
this.initialVelocity = initialVelocity; | |
this.duration = duration; | |
this.acceleration = acceleration; | |
this.mass = mass; | |
} | |
public double displacement(){ | |
return (initialVelocity*duration)+(0.5*acceleration*Math.pow(duration,2)); | |
} | |
public double currentMomentum(){ | |
return mass*initialVelocity; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment