-- Chapter 18 - Program 2 with Text_IO; use Text_IO; procedure Default2 is package Int_IO is new Text_IO.Integer_IO(INTEGER); use Int_IO; Index : INTEGER; Animal_Sum : INTEGER; function Cow_Constant return INTEGER is begin return 7; end Cow_Constant; function Pig_Constant return INTEGER is Animals : INTEGER := Cow_Constant - 3; begin return 2 * Animals + 5; end Pig_Constant; procedure Animals(Total : in out INTEGER; Cows : in INTEGER := 2 * Cow_Constant; Pigs : in INTEGER := Cow_Constant + Pig_Constant; Dogs : in INTEGER := 0) is begin Total := Cows + Pigs + Dogs; Put("Cows ="); Put(Cows,3); Put(" Pigs ="); Put(Pigs,3); Put(" Dogs ="); Put(Dogs,3); Put(" and they total"); Put(Total,4); New_Line; end Animals; begin Index := 3; Animals(Animal_Sum,2,3,4); Animals(Animal_Sum,2,Index,4); Animals(Dogs => 4,Total => Animal_Sum); Animals(Total => Animal_Sum,Pigs => 2*Index + 1,Cows => 5); Animals(Dogs => Index + 4,Total => Animal_Sum); Animals(Animal_Sum,Dogs => 4,Pigs => Index,Cows => 2); Animals(Animal_Sum); end Default2; -- Result of Execution -- Cows = 2 Pigs = 3 Dogs = 4 and they total 9 -- Cows = 2 Pigs = 3 Dogs = 4 and they total 9 -- Cows = 14 Pigs = 20 Dogs = 4 and they total 38 -- Cows = 5 Pigs = 7 Dogs = 0 and they total 12 -- Cows = 14 Pigs = 20 Dogs = 7 and they total 41 -- Cows = 2 Pigs = 3 Dogs = 4 and they total 9 -- Cows = 14 Pigs = 20 Dogs = 0 and they total 34