{Stuart Wells}

{12/7/10}

{Contest #1}

{Enloe High School}

{Junior}

{Johnson}

 

{program Prints}

{ACSL Competition program to give the Henry classification for fingerprints}

{Stuart Wells 11/2/10}

 

program Prints;

 

uses crt;

 

TYPE

 

    i_array= array[1..10] of integer;

 

 

VAR

      hand1: i_array;

    top: integer;

    bottom: integer;

    counter: integer;

 

procedure input(VAR hand1: i_array; counter: integer);

 

begin {input begin}

      counter:= 0;

      Writeln('Henry Classification System');

    Writeln('Input fingers numbers for first person, hitting enter in between each');

    repeat

      counter:= counter + 1;

      readln(hand1[counter]);

    until(hand1[counter]= 0);

end; {input end}

 

procedure calculate(VAR hand1: i_array;VAR top, bottom: integer; counter: integer);

 

VAR

    hand11: i_array;

 

begin {input begin}

      counter:= 1;

      repeat

      If(hand1[counter]= 10) then

        begin

            hand11[counter]:= 1;

        end

        else if(hand1[counter]= 9) then

        begin

            hand11[counter]:= 1;

        end

        else if(hand1[counter]= 8) then

        begin

            hand11[counter]:= 2;

        end

        else if(hand1[counter]= 7) then

        begin

            hand11[counter]:= 2;

        end

        else if(hand1[counter]= 6) then

        begin

            hand11[counter]:= 4;

        end

        else if(hand1[counter]= 1) then

        begin

            hand11[counter]:= 16;

        end

        else if(hand1[counter]= 2) then

        begin

            hand11[counter]:= 16;

        end

        else if(hand1[counter]= 3) then

        begin

            hand11[counter]:= 8;

        end

        else if(hand1[counter]= 4) then

        begin

            hand11[counter]:= 8;

        end

        else if(hand1[counter]= 5) then

        begin

            hand11[counter]:= 4;

        end;

        counter:= counter + 1;

    until(hand1[counter]= 0);

    counter:= 1;

    top:=1;

    bottom:= 1;

    If(hand1[1]<> 0) then

    begin

            repeat

            If(hand1[counter]=2) or (hand1[counter]=4) or (hand1[counter]=6) or (hand1[counter]=8) or (hand1[counter]=10) then

              begin

            top:= top + hand11[counter];

            end;

              If(hand1[counter]=1) or (hand1[counter]=3) or (hand1[counter]=5) or (hand1[counter]=7) or (hand1[counter]=9) then

          begin

                  bottom:= bottom + hand11[counter];

              end;

            counter:= counter + 1;

          until(hand1[counter]= 0);

    end;

end; {calculate end}

 

procedure output(top, bottom: integer);

begin {output begin}

      Writeln('Primary Group Ratio:');

    Writeln(top,'/',bottom);

end; {output end}

 

Begin {Main Begin}

      clrscr;

    For counter:= 1 to 5 do

    begin

      input(hand1, counter);

        calculate(hand1, top, bottom, counter);

        writeln;

        output(top, bottom);

        readln;

    end;

End. {Main End}