PROGRAM Temperature_Conversion_2 
!-----------------------------------------------------------------------
! Program to convert several Fahrenheit temperatures to the 
! corresponding Celsius temperatures.  The function Fahr_to_Celsius
! from module Temperature is used to perform the conversions.  
! Identifiers used are: 
!   Fahr_to_Celsius : module function subprogram that converts
!                     Fahrenheit temperatures to Celsius
!   FahrenheitTemp  : a Fahrenheit temperature to be converted
!   CelsiusTemp     : the corresponding Celsius temperature
!   Response        : user response to "More data?" query
!
! Imported: Fahr_to_Celsius from module Temperature 
! Input:    FahrenheitTemp, Response
! Output:   CelsiusTemp
!-----------------------------------------------------------------------

  USE Temperature

  IMPLICIT NONE
  REAL :: FahrenheitTemp, CelsiusTemp
  CHARACTER(1) :: Response

  DO
     ! Get a Fahrenheit temperature
     WRITE (*, '(1X, A)', ADVANCE = "NO") "Enter a Fahrenheit temperature: "
     READ *, FahrenheitTemp
 
     ! Use the module function Fahr_to_Celsius to convert it to Celsius
     CelsiusTemp = Fahr_to_Celsius(FahrenheitTemp)
 
     ! Output the result
     PRINT '(1X, 2(F6.2, A))', FahrenheitTemp, &
           " in Fahrenheit is equivalent to ", CelsiusTemp, " in Celsius"
 
     ! Check if more temperatures are to be converted
     WRITE (*, '(/ 1X, A)', ADVANCE = "NO") &
           "More temperatures to convert (Y or N)? "
     READ *, Response
     IF (Response /= "Y") EXIT
  END DO

END PROGRAM Temperature_Conversion_2 
