PROGRAM Projectile_2
!---------------------------------------------------------------------
! This program calculates the velocity and height of a projectile
! given its initial height, initial velocity, and constant
! acceleration. Identifiers used are:
!   InitialHeight   : initial height of projectile (meters)
!   Height          : height at any time (meters)
!   InitialVelocity : initial vertical velocity (m/sec)
!   Velocity        : vertical velocity at any time (m/sec)
!   Acceleration    : constant vertical acceleration (m/sec/sec)
!   Time            : time since launch (seconds)
!
! Input (file):   InitialHeight, InitialVelocity, Time
! Output (file):  Velocity, Height 
!---------------------------------------------------------------------

  IMPLICIT NONE
  REAL :: InitialHeight, Height, InitialVelocity, Velocity, Time
  REAL, PARAMETER :: Acceleration = -9.80665

  ! Open disk files FIG2-6.DAT and FIG2-6.OUT
  OPEN(UNIT = 12, FILE = "FIG2-6.DAT", STATUS = "OLD")
  OPEN(UNIT = 13, FILE = "FIG2-6.OUT", STATUS = "NEW")

  ! Read values for InitialHeight, InitialVeloc, and Time
  READ (12, *) InitialHeight, InitialVelocity, Time

  ! Calculate the height and velocity
  Height = 0.5 * Acceleration * Time ** 2  &
           + InitialVelocity* Time + InitialHeight
  Velocity = Acceleration * Time + InitialVelocity

  ! Write values of Time, Velocity, and Height to FIG2-6.OUT
  WRITE (13, *) "At time", Time, "seconds"
  WRITE (13, *) "the vertical velocity is", Velocity, "m/sec"
  WRITE (13, *) "and the height is", Height, "meters"

  ! Signal user that program is finished
  PRINT *, "*** Program is finished ***"
  STOP
END PROGRAM Projectile_2
