with Text_IO, Ada.Integer_Text_IO; use Text_IO, Ada.Integer_Text_IO; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with Ada.Float_Text_IO; use Ada.Float_Text_IO; package body Teams is procedure Make (T: in out Team) is begin T.Wins := 0; T.Losses := 0; end make; procedure Make (T: out Footballteam) is begin T.Wins := 0; T.Losses := 0; T.Quarterback := To_Unbounded_String("mike"); end make; procedure Make (T: out Hockeyteam) is begin Make(Team(T)); -- call base type constructor T.goalie := To_Unbounded_String("mark"); end make; procedure Win(T : in out Team'Class) is begin T.Wins := T.Wins + 1; end win; procedure Lose(T : in out Team'Class) is begin T.Losses := T.Losses + 1; end lose; function Wp(T : in Team'Class) return Float is W : Float; L : Float; begin W := Float(T.Wins); L := Float(T.Losses); return W/(W+L); end Wp; -- the following procedures illustrates dynamic dispatch in Ada95: procedure Printinfo(T: in Team'Class) is begin Put(T.Wins,Width => 2); Put(" wins and "); Put(T.Losses,Width => 2); New_line; Info(T); -- dispatches to correct info procedure end Printinfo; procedure Info(T: in Footballteam) is begin Put("The quarterback is "); Put(To_String(T.Quarterback)); New_Line; end Info; procedure Info(T: in Hockeyteam) is begin Put("The goalie is "); Put(To_String(T.Goalie)); New_Line; end Info; end Teams;