PROGRAM Temperature_RH !----------------------------------------------------------------------- ! Program ask user to enter temperature and dew point in degrees Celsius. ! Once entered, the program calculuates the relative humidity and dew ! point depression from the entered data. This program required the use ! of a subroutine and a separate function to calculate the vapor pressure ! which is need for the relative humidity calculation. ! ! Identifiers used are: ! Temperature : Temperature entered by the user (Celsius). ! Dew_Point : Dew point temperature entered by the user (Celsius). ! RH : Relative humidty returned from subroutine. ! Depr : Dew point depression returned from subroutine. ! Response : user response to "More data?" query ! ! Input: FahrenheitTemp, Response ! Output: CelsiusTemp ! Required: !----------------------------------------------------------------------- USE Temp_RH IMPLICIT NONE REAL :: Temperature, Dew_Point REAL :: RH, Depr CHARACTER(1) :: Response DO ! Get a the temperature from the user in degrees Celsius. WRITE (*, '(1X, A)', ADVANCE = "NO") "Enter the temperature (Celsius): " READ *, Temperature ! Get a the dew point temperature from the user in degrees Celsius. WRITE (*, '(1X, A)', ADVANCE = "NO") "Enter a dew point temperature & (Celsius): " READ *, Dew_Point ! Use the moisture_calc subroutine to get the relative humidity and ! dew point depression of the data entered by the user. CALL moisture_calc(Temperature,Dew_Point,RH, Depr) ! Output the results PRINT '(1X, A, F6.2, 1X, A)', "Temperature = ", Temperature, "Celsius" PRINT '(1X, A, F6.2, 1X, A)', "Dew Point Temperature = ", Dew_Point, & "Celsius" PRINT '(1X, A, F6.2, 1X, A)', "Relative Humidity = ", RH, "%" PRINT '(1X, A, F6.2, 1X, A)', "Dew Point Temperature = ", Depr, "Celsius" ! Check if more temperatures are to be converted WRITE (*, '(/ 1X, A)', ADVANCE = "NO") & "Would you like to run the program again (Y or N)? " READ *, Response IF (Response /= "Y") EXIT END DO END PROGRAM Temperature_RH