Top Post

Top Post

Posted by : Efdi Minggu, 01 Desember 2013


unit luas_persegi_panjang;

interface

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

type
  TForm1 = class(TForm)
    edtLebar: TEdit;
    lbPanjang: TLabel;
    lbLebar: TLabel;
    edtPanjang: TEdit;
    lbLuas: TLabel;
    lbLKeliling: TLabel;
    edtLuas: TEdit;
    edtKeliling: TEdit;
    btnHitung: TButton;
    btnReset: TButton;
    btnClose: TButton;
    Label1: TLabel;
    procedure btnCloseClick(Sender: TObject);
    procedure btnResetClick(Sender: TObject);
    procedure btnHitungClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.btnCloseClick(Sender: TObject);
begin
  close;
end;

procedure TForm1.btnResetClick(Sender: TObject);
begin
  edtPanjang.Text:='';
  btnReset.Caption:='reset';
  edtLebar.Text:='';
  btnReset.Caption:='reset';
  edtLuas.Text:='';
  btnReset.Caption:='reset';
  edtKeliling.Text:='';
  btnReset.Caption:='reset';
end;

procedure TForm1.btnHitungClick(Sender: TObject);
Var
  nPanjang : Integer;
  nLebar : Integer;
  nLuas : Integer ;
  nKeliling : Integer ;
begin
  nPanjang := StrToInt(edtPanjang.text);
  nLebar := StrToInt(edtLebar.Text);
  nLuas := nPanjang * nLebar;
  nKeliling := (nPanjang + nLebar) *2;
  edtLuas.text := IntToStr(nLuas);
  edtKeliling.text := IntToStr(nKeliling);
end;

end.

Leave a Reply

Saran dan kritik Anda merupakan semangat bagi kami. Terima kasih...!

Subscribe to Posts | Subscribe to Comments

|| Copyright © 2014 Fakti UPY || Powered by Blogger || Designed by Mbah Jass ||