--  Store the employees in an array
--  Pass a count as a parameter

with ada.text_io; use ada.text_io; 
with ada.float_text_io; use ada.float_text_io; 
 
procedure emp2  is 
   type Employee is record
      Name: String(1 .. 20);
      ID: String(1 .. 6);
      Salary: Float;
   end record;

   type Emp_Array is array(1 .. 10) of Employee;

   --  Add all employees to list
   procedure get_emps(emps: out Emp_Array; num_emps: out Natural) is
      e_tmp: Employee;
   begin
      num_emps := 0;
      while not end_of_file loop
         num_emps := num_emps + 1;

         get(e_tmp.Name);
         get(e_tmp.ID);
         get(e_tmp.salary);

         emps(num_emps) := e_tmp;
      end loop;
   end get_emps;

   --  Print all the employees
   procedure put_emps(emps: in Emp_Array; num_emps: Natural) is
      e_tmp: Employee;
   begin
      for i in 1 .. num_emps loop
         e_tmp := emps(i);
         put(e_tmp.Name);
         put(e_tmp.ID);
         put(e_tmp.salary, 7, 2, 0);
         new_line;
      end loop;
   end put_emps;

   the_emps: Emp_Array;
   num_emps: Natural;

begin
   get_emps(the_emps, num_emps);
   put_emps(the_emps, num_emps);

end emp2;