!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! This is a program which allows the user to compute ! ! the hypotenuse of any number of right triangles. ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! program p6 implicit none real::base,altitude,hypotenuse,pythagoras logical::user_wants_another call greeting() do call read_base_altitude(base,altitude) hypotenuse = pythagoras(base,altitude) call write_base_altitude_hypotenuse(base,altitude,hypotenuse) if ( .not. user_wants_another() ) exit end do call good_bye() end program subroutine greeting() ! prints opening message !! ADDITIONAL STATEMENTS NEEDED HERE end subroutine subroutine read_base_altitude(b,h) ! output condition: b > 0 and h > 0 ! prompts the user to enter positive values for base and height of a right ! triangle. Continues to query user until positive values are obtained. !! ADDITIONAL STATEMENTS NEEDED HERE end subroutine subroutine write_base_altitude_hypotenuse(base,altitude,hypotenuse) real,intent(in)::base,altitude,hypotenuse ! input condition: all actual arguments are positive, and are less than 100 ! output condition: an appropriate summary is written to the screen ! with two decimal place accuracy !! ADDITIONAL STATEMENTS NEEDED HERE end subroutine real function pythagoras(a,b) ! input condition: a > 0 and b > 0 ! output condition: the square of the function value ! is the sum of the squares of a and b real,intent(in)::a,b !! ADDITIONAL STATEMENTS NEEDED HERE end function logical function user_wants_another() ! queries the user ! output condition: whether the user wants to work another problem !! ADDITIONAL STATEMENTS NEEDED HERE end function subroutine good_bye() ! prints closing message !! ADDITIONAL STATEMENTS NEEDED HERE end subroutine