-- Chapter 31 - Program 5 generic type ITEM is range <>; with function Funny_Average(A, B, C : ITEM) return ITEM; package Dis_Avg is procedure Display_Funny_Average(A, B, C : ITEM); end Dis_Avg; with Ada.Text_IO; use Ada.Text_IO; package body Dis_Avg is package Int_IO is new Ada.Text_IO.Integer_IO(ITEM); use Int_IO; procedure Display_Funny_Average(A, B, C : ITEM) is Mean : ITEM; begin Mean := Funny_Average(A, B, C); Put("The funny average is "); Put(Mean, 5); New_Line; end Display_Funny_Average; end Dis_Avg; with Dis_Avg; procedure FuncPkg is function R_Average(First, Second, Third : INTEGER) return INTEGER is begin return (First + 2 * Second + Third) / 4; end R_Average; package Averages is new Dis_Avg(INTEGER, R_Average); begin Averages.Display_Funny_Average(1, 3, 5); Averages.Display_Funny_Average(1, 3, 17); Averages.Display_Funny_Average(3, 17, 5); end FuncPkg; -- Result of execution -- The funny average is 3 -- The funny average is 6 -- The funny average is 10