      module surdata
      real :: d,A,h
c
c    d    - distance measured by laser range finder
c    A    - Angle of inclination of the range sighting
c           above the horizontal
c    h    - calculated elevation change from ground level at
c           the base of the range finder to the reflector location
c           at the top of the mountain  (assumes actual range
c           finder position is 5 feet above ground level)
c
      end module 
c
      program height
c
      implicit none
c
c   Calculate the height of a mountain relative to the current
c   location.
c
c   Programmed by: John Mahaffy  1/22/97
c
      call input
c
      call deltah
c
      call output
      stop
      end
c
      subroutine deltah
      use surdata
      implicit none
c
c   Apply the simple trigonometry to calculate elevation change
c   (5 feet added for instrument location)
c
c   Programmed by: John Mahaffy  1/22/97
c   Modified by:
c
c---------------------------------------------------------
      h = d*sin(A)+5.0
c---------------------------------------------------------
      return
      end
c
      subroutine input 
      use surdata
      implicit none
c
c   Prompt for and read the measured distance and inclination
c   angle.
c
c     pi - constant; 3.1415926536
c
c   Programmed by: John Mahaffy  1/22/97
c
      real, parameter :: pi=3.1415926536
c
      write(*,2000,advance='no')
      read *, d
      write (*,2001,advance='no')
      read *, A
      A = A*(pi/180)
      return
 2000 format(' Range Finder Distance Readout: ')
 2001 format(' Range Finder Inclination Angle: ')
      end
c
      subroutine output
      use surdata
      implicit none
c
c   Print the Elevation Change
c
c   Programmed by: John Mahaffy  1/22/97
c
      write  (*,2000) nint(h)
 2000 format ('Elevation change to mountain top: ',i6,' feet')
      return
      end
