// ---------------------------------------------------------------------------
// This program simulates dropping an object from the top of the Washington
// Monument in Washington D.C.  The result is a print of the height of the ball
// each second until the ball hits the ground.
//
// The height an object will fall under the influence of gravity is approxmately
// (1/2 * g * t^2)
//
// 6/18/98  Paul McNamee
// ---------------------------------------------------------------------------

public class DropObject {
  public static void main (String [] args) {
    float height = 550, drop = 0;
    for (int time=0; drop < height; time++)  {
      drop = Distance(time);
      System.out.print( "At time " + time + " the Height of the ball is "
                        + (height - drop) + " feet\n") ;
    }
  }
  
  // Returns distance in feet for an object in free fall
  static float Distance (float time) {
    // 32.0 feet per second is the gravitation constant
    return 0.5F * 32.0F * Square(time);
  }


  // Returns the square of a number
  static float Square (float x) {
	return x * x;
  }
}

// When run, this program produces the following output:
//   At time 0 the Height of the ball is 550.0 feet
//   At time 1 the Height of the ball is 534.0 feet
//   At time 2 the Height of the ball is 486.0 feet
//   At time 3 the Height of the ball is 406.0 feet
//   At time 4 the Height of the ball is 294.0 feet
//   At time 5 the Height of the ball is 150.0 feet
//   At time 6 the Height of the ball is -26.0 feet
