!block up ramp

module real_kinds
integer, parameter :: spt = kind (1.0)
integer, parameter :: dpt = kind (1.0d0)
end module real_kinds

!use real_kinds

program ramp
use real_kinds
implicit none

!integer, parameter :: dpt = kind(1.0d0)

imaginary (kind=dpt) :: v 
real (kind=dpt), parameter :: u = 0.25_dpt
real (kind=dpt), parameter :: pi = 3.141592_dpt
real (kind=dpt) :: g, theta, d 
character (len=9) :: angle

g = 9.8_dpt


write (*,*) "what is the initial speed of the block?"
read (*,*) v
write(*,*) "is the angle in degrees or radians?"
read(*,*) angle
write(*,*) "what is the angle measure?"
read(*,*) theta

if (angle == 'degrees') then
	Write(*,*) "your angle in degrees could not be used so it was converted to"
  call degrees_sub (theta, pi)
  write(*,*)  theta, "rads"
  call equation_sub (d, v, g, theta, u, pi)
else if (angle == 'radians') then
  write (*,*) "your angle is", theta, "in radians" 
  call equation_sub (d, v, g, theta, u, pi)
end if

write(*,*) d

stop
end program ramp



subroutine degrees_sub (ang, pie)
use real_kinds
implicit none

real (kind=dpt), intent (out):: ang
real (kind=dpt), intent (in) :: pie

ang = (ang*pie)/180_dpt

return
end subroutine degrees_sub



subroutine equation_sub (x, vel, grav, rads, mew, pie)
use real_kinds
implicit none

real (kind=dpt), intent (out) :: x
real (kind=dpt), intent (in) :: vel
real (kind=dpt), intent (in) :: grav
real (kind=dpt), intent (in) :: rads
real (kind=dpt), intent (in) :: mew
real (kind=dpt), intent (in) :: pie

if ((rads<(pie/2_dpt)).and.(rads>0)) then
   x = vel**2_dpt/(2_dpt*grav*(mew*cos(rads) + sin(rads)))
   write(*,*) "the block traveled this far", x, "meters"
else if (rads<0) then
   write(*,*) "you're minecrafting"
else if (rads>=(pie/2_dpt)) then
   write(*,*) "man thats not a ramp"
end if

return
end subroutine equation_sub