Contoh Program Hitung Luas Lingkaran dan Persegi Bahasa Pemrograman Delphi
Berikut Contoh Tampilan Program Hitung Luas Lingkaran dan Persegi Bahasa Pemrograman beserta script dan file Project nya
1. Tampilan Menghitung Keliling Lingkaran
Untuk Mendownload File Project Delphi silahkan klik link berikut Contoh Pemrograman Delphi bangun datar
Demikian Program Sederhana Menghitung Keliling dan Luas persegi juga lingkaran
1. Tampilan Menghitung Keliling Lingkaran
2. Tampilan Menghitung Luas Lingkaran
3. Tampilan Menghitung Keliling Persegi
4. Tampilan Menghitung Luas Persegi
5. Tampilan Form Exit
Script Program Di atas adalah sebagai berikut
unit BangunDatar;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm3 = class(TForm)
GroupBox1: TGroupBox;
tr: TEdit;
thasil: TEdit;
tkeliling: TButton;
tluas: TButton;
Label1: TLabel;
Label2: TLabel;
tclear: TButton;
texit: TButton;
GroupBox2: TGroupBox;
Label3: TLabel;
Label4: TLabel;
ts: TEdit;
thasil2: TEdit;
tkeliling2: TButton;
tluas2: TButton;
procedure tclearClick(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure tkelilingClick(Sender: TObject);
procedure texitClick(Sender: TObject);
procedure tluasClick(Sender: TObject);
procedure tkeliling2Click(Sender: TObject);
procedure tluas2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
r,s:integer;
end;
var
Form3: TForm3;
const
phi=3.14;
implementation
{$R *.dfm}
procedure TForm3.tclearClick(Sender: TObject);
begin
tr.Text:='';
thasil.Text:='0';
ts.Text:='';
thasil2.Text :='0';
end;
procedure TForm3.FormActivate(Sender: TObject);
begin
tclear.Click;
end;
procedure TForm3.tkelilingClick(Sender: TObject);
begin
r:=strtoint(tr.Text);
thasil.Text:=floattostr(2*phi*r);
end;
procedure TForm3.texitClick(Sender: TObject);
begin
messagedlg('Form Akan Di Tutup',mtConfirmation,[mbOK],0);
close;
end;
procedure TForm3.tluasClick(Sender: TObject);
begin
r:=strtoint(tr.Text);
thasil.Text:=floattostr(phi*(r*r));
end;
procedure TForm3.tkeliling2Click(Sender: TObject);
begin
s:=strtoint(ts.Text);
thasil2.Text:=floattostr(4*s);
end;
procedure TForm3.tluas2Click(Sender: TObject);
begin
s:=strtoint(ts.Text);
thasil2.Text:=floattostr(s*s);
end;
end.
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm3 = class(TForm)
GroupBox1: TGroupBox;
tr: TEdit;
thasil: TEdit;
tkeliling: TButton;
tluas: TButton;
Label1: TLabel;
Label2: TLabel;
tclear: TButton;
texit: TButton;
GroupBox2: TGroupBox;
Label3: TLabel;
Label4: TLabel;
ts: TEdit;
thasil2: TEdit;
tkeliling2: TButton;
tluas2: TButton;
procedure tclearClick(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure tkelilingClick(Sender: TObject);
procedure texitClick(Sender: TObject);
procedure tluasClick(Sender: TObject);
procedure tkeliling2Click(Sender: TObject);
procedure tluas2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
r,s:integer;
end;
var
Form3: TForm3;
const
phi=3.14;
implementation
{$R *.dfm}
procedure TForm3.tclearClick(Sender: TObject);
begin
tr.Text:='';
thasil.Text:='0';
ts.Text:='';
thasil2.Text :='0';
end;
procedure TForm3.FormActivate(Sender: TObject);
begin
tclear.Click;
end;
procedure TForm3.tkelilingClick(Sender: TObject);
begin
r:=strtoint(tr.Text);
thasil.Text:=floattostr(2*phi*r);
end;
procedure TForm3.texitClick(Sender: TObject);
begin
messagedlg('Form Akan Di Tutup',mtConfirmation,[mbOK],0);
close;
end;
procedure TForm3.tluasClick(Sender: TObject);
begin
r:=strtoint(tr.Text);
thasil.Text:=floattostr(phi*(r*r));
end;
procedure TForm3.tkeliling2Click(Sender: TObject);
begin
s:=strtoint(ts.Text);
thasil2.Text:=floattostr(4*s);
end;
procedure TForm3.tluas2Click(Sender: TObject);
begin
s:=strtoint(ts.Text);
thasil2.Text:=floattostr(s*s);
end;
end.
Demikian Program Sederhana Menghitung Keliling dan Luas persegi juga lingkaran
0 komentar: