with ada.text_io; use ada.text_io; 
with ada.float_text_io; use ada.float_text_io; 
 
procedure rec4  is 
    namesize: constant := 20;
    idsize: constant := 6;
    maxnumemp: constant := 100;

    type emprecord is record
        name: string(1 .. namesize);
        id: string(1 .. idsize);
        salary: float;
    end record;

    type emparray is array(1 .. maxnumemp) of emprecord; 

    type emp_list is record
        my_emps: emparray;
        count: natural := 0;
    end record;

    procedure get_emps(some_emps: out emp_list) is
        e: emprecord;
    begin
        skip_line;
        while not end_of_file loop
            get(e.name);
            get(e.id);
            get(e.salary);

            some_emps.count := some_emps.count + 1;
            some_emps.my_emps(some_emps.count) := e;
        end loop;
    end get_emps;

    procedure put_emps(the_emps: emp_list) is 
        e: emprecord;
    begin
        for i in reverse 1 .. the_emps.count loop
            e := the_emps.my_emps(i);
            if e.salary > -100_000.00 then
                put(e.name & " ");
                put(e.id & " ");
                put(e.salary, fore=>7, aft=>2, exp=>0);
                new_line;
            end if;
        end loop;
    end put_emps;

    the_emps: emp_list;
begin

    get_emps(the_emps);
    put_emps(the_emps);

end rec4;