PROGRAM Process_Circles_4 !----------------------------------------------------------- ! Program to read centers and radii of several circles ! and display the areas of those that are not the unit ! circle. ! Imports from module Circle: ! derived type Circle ! derived type Point ! operator == ! parameter Pi ! function Area ! Other identifiers used: ! UnitCircle : unit circle, centered at origin, ! radius = 1. ! Cir : a circle ! Input: Circle Cir ! Output: Area of Cir or message indicating Cir is the ! unit circle !----------------------------------------------------------- USE Circle_Type TYPE (Circle) :: UnitCircle = Circle(Point(0.0, 0.0), 1.0), Cir ! Process circles DO PRINT *, "Enter radius of circle (negative to stop):" READ *, Cir%Radius IF (Cir%Radius < 0) EXIT PRINT *, "Enter coordinates of center of Circle:" READ *, Cir %Center%X, Cir %Center%Y ! Check if Cir is the unit circle and display its ! area if it is not IF (Cir == UnitCircle) THEN PRINT *, "Circle is the unit circle" ELSE PRINT *, "Area = ", Area(Cir) END IF PRINT * END DO END PROGRAM Process_Circles_4