PROGRAM HurricaneEnsemble

! Written by Kate T-C
! August 27, 2009  For the Fortran Short Course
! This program demonstrates a Select/Case block
!   and random number generation in Fortran

implicit none

real :: harvest=0.0
integer, dimension(8) :: time
integer :: rand, count=0
integer, dimension(6) :: results=0

  call date_and_time(values=time)
  call random_seed(put=time(8:8))

DO count=1,100

  call random_number(harvest)
 
  rand = floor(harvest*12)
  
  SELECT CASE(rand)
	CASE (0,1)  ! Tropical Storm = 1
	  results(1) = results(1)+1
	CASE (2,3) ! Catagory 1 = 2
	  results(2) = results(2)+1
	CASE (4,5) ! Catagory 2 = 3
	  results(3) = results(3)+1
	CASE (6,7) ! Catagory 3 = 4
	  results(4) = results(4)+1
	CASE (8,9) ! Catagory 4 = 5
	  results(4) = results(5)+1
	CASE DEFAULT  ! Catagory 5 = 6
	  results(5) = results(6)+1
	END SELECT
		
ENDDO

print *, 'The intensity of Tropical Storm Danny will be....'
print *, 'Tropical Storm:', results(1), ' models'
print *, 'Cat 1', results(2), ' models'
print *, 'Cat 2', results(3), ' models'
print *, 'Cat 3', results(4), ' models'
print *, 'Cat 4', results(5), ' models'
print *, 'Catagory 5', results(5), ' models! w00t!'

END
