                                       (* Chapter 13 - Program 1 *)
unit Areas;
(*****************************************************************)
(*                                                               *)
(* This unit includes a collection of functions to calculate the *)
(* areas of four different geometric shapes.                     *)
(*                                                               *)
(*****************************************************************)

interface
   function Area_Of_Circle(Radius : real ) : real;
   function Area_Of_Square(Length_Of_Side : real) : real;
   function Area_Of_Rectangle(Length,Width : real) : real;
   function Area_Of_Triangle(Base, Height : real) : real;

implementation

var My_Pi : real;

procedure Mult_Two_Numbers(Number1, Number2 : real;
                           var Result : real);
begin
   Result := Number1 * Number2;
end;

function Area_Of_Circle;
var Rad_Squared : real;
begin
   Mult_Two_Numbers(Radius,Radius,Rad_Squared);
   Area_Of_Circle := Rad_Squared * My_Pi;
end;

function Area_Of_Square;
begin
   Area_Of_Square := Length_Of_Side * Length_Of_Side;
end;

function Area_Of_Rectangle;
begin
   Area_Of_Rectangle := Length * Width;
end;

function Area_Of_Triangle;
begin
   Area_Of_Triangle := Base * Height / 2.0;
end;

begin                   (* This is the initialization code *)
   My_Pi := 3.14159267;
end.  (* of unit Areas *)




{ Result of execution

(A unit cannot be executed)

}
