-- Chapter 15 - Program 3 with Ada.Text_IO, Ada.Float_Text_IO; use Ada.Text_IO, Ada.Float_Text_IO; procedure Adder2 is FIRST : constant := 2; LAST : constant := 7; Sum_Of_Values : FLOAT; -- Interface of Package1 package AdderPkg is type MY_ARRAY is array(INTEGER range <>) of FLOAT; procedure Add_Em_Up(In_Dat : in MY_ARRAY; Sum : out FLOAT); end AdderPkg; use Adder2.AdderPkg; New_Array : MY_ARRAY(FIRST..LAST); -- Implementation of Package1 package body AdderPkg is procedure Add_Em_Up(In_Dat : in MY_ARRAY; Sum : out FLOAT) is Total : FLOAT; begin Total := 0.0; for Index in In_Dat'FIRST..In_Dat'LAST loop Total := Total + In_Dat(Index); end loop; Sum := Total; end Add_Em_Up; end AdderPkg; begin for Index in New_Array'FIRST..New_Array'LAST loop New_Array(Index) := FLOAT(Index); end loop; Put_Line("Call Add_Em_Up now"); Add_Em_Up(New_Array, Sum_Of_Values); Put("Back from Add_Em_Up, total is"); Put(Sum_Of_Values, 5, 2, 0); New_Line; end Adder2; -- Result of execution -- Call Add_Em_Up now -- Back from Add_Em_Up, total is 27.00