unit DogAgeUnit;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls, ComCtrls, Spin;

type
  TfrmDogAge = class(TForm)
    pnlTop: TPanel;
    imgLeft: TImage;
    imgRight: TImage;
    btnGenListFor: TButton;
    redAgeList: TRichEdit;
    btnGenListRepUntil: TButton;
    edtPounds: TEdit;
    sedHumanYears: TSpinEdit;
    Label1: TLabel;
    Label2: TLabel;
    btnGetDogAge: TButton;
    lblAgeResult: TLabel;
    Bevel1: TBevel;
    procedure btnGenListForClick(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure btnGenListRepUntilClick(Sender: TObject);
    procedure btnGetDogAgeClick(Sender: TObject);
  private
    { Private declarations }
    function getListAge(rWeight: Real; iHumanYears : Integer): Integer;
  public
    { Public declarations }
  end;

var
  frmDogAge: TfrmDogAge;

implementation

{$R *.dfm}
//==============================================================================
procedure TfrmDogAge.btnGenListForClick(Sender: TObject);
Var
  I : Integer;
begin
redAgeList.Clear;
for I := 1 to 20 do
  begin
    redAgeList.Lines.Add('Year :' + IntToStr(I)
          +  #9 +#9 + IntToStr(getListAge(8,I))
          +  #9 +#9 + IntToStr(getListAge(22,I))
          +  #9 +#9 + IntToStr(getListAge(40,I))
          +  #9 +#9 + IntToStr(getListAge(42,I)));
  end;
end;
//==============================================================================
procedure TfrmDogAge.btnGenListRepUntilClick(Sender: TObject);
var
  K : Integer;
begin
  //1.2.3
  
end;
//==============================================================================
procedure TfrmDogAge.btnGetDogAgeClick(Sender: TObject);
var
  rKiloWeight : Real;
begin
  //1.2.4
end;
//==============================================================================
procedure TfrmDogAge.FormShow(Sender: TObject);
begin
   //1.2.1

end;
//==============================================================================
function TfrmDogAge.getListAge(rWeight: Real; iHumanYears : Integer): Integer;
var
  iStep , iStart : Integer;
begin
  if rWeight > 41  then
    begin
      iStep := 7;
      iStart := 14;
    end
  else
    if rWeight > 23 then
      begin
        iStep := 5;
        iStart := 20;
      end
    else
       if rWeight > 9 then
         begin
           iStep := 5;
           iStart := 17;
         end
       else
         begin
           iStep := 4;
           iStart := 20;
         end;
  Result := ((iHumanYears-1) * iStep) + iStart;

end;
//==============================================================================

//==============================================================================
end.
