// Allison Obourn
// CS& 141, Autumn 2021
// Lecture 5

// This program prints out the displacement of an object with a starting 
// velocity of 3 and an acceleration of 4 at time 5 seconds

public class Displacement {
   public static void main(String[] args) {
      System.out.println("result: " + displacement(3.0, 4.0, 5.0));
   }
   
   // takes an initial velocity in m/s, an acceleration in m/s2 and a time in
   // seconds and returns the displacement. This displacement is calculated using
   // the formula v0t + 0.5at^2
   public static double displacement(double v0, double a, double t) {
      double disp = v0 * t + 0.5 * a * t * t;
      return disp;
   }
}