Ini Dia Listing Program :
unit Utst1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, jpeg;
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
EdA: TEdit;
EdC: TEdit;
EdD: TEdit;
GroupBox1: TGroupBox;
rb1: TRadioButton;
rb2: TRadioButton;
rb3: TRadioButton;
rb4: TRadioButton;
rb5: TRadioButton;
rb6: TRadioButton;
rb7: TRadioButton;
Label5: TLabel;
EdHasil: TEdit;
EdB: TEdit;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
EdAwal: TEdit;
EdAkhir: TEdit;
EdStep: TEdit;
Label9: TLabel;
Label10: TLabel;
Label11: TLabel;
EdPremium: TEdit;
EdPertamax: TEdit;
EdSolar: TEdit;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Label12: TLabel;
Label13: TLabel;
Label14: TLabel;
Label15: TLabel;
Memo1: TMemo;
Memo2: TMemo;
Memo3: TMemo;
Memo4: TMemo;
Image1: TImage;
Image2: TImage;
Image3: TImage;
procedure rb3Click(Sender: TObject);
procedure rb4Click(Sender: TObject);
procedure rb5Click(Sender: TObject);
procedure rb6Click(Sender: TObject);
procedure rb7Click(Sender: TObject);
procedure rb1Click(Sender: TObject);
procedure rb2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
a,b,c,d,e,f,g,h:real;
i,n: integer;
faktorial,kc,kb : real;
const
premium=4500;
pertamax=9500;
Solar=4500;
implementation
{$R *.dfm}
procedure TForm1.rb3Click(Sender: TObject);
begin
a:=StrTofloat(EdA.text);
b:=StrTofloat(EdB.text);
c:=StrTofloat(EdC.text);
d:=StrTofloat(EdD.Text);
e:=(a*c)+(b*d);
if rb3.Checked then
EdHasil.text :=FloattoStr(e);
end;
procedure TForm1.rb4Click(Sender: TObject);
begin
n:=strtoint(EdA.Text);
faktorial:=1;
for i:=2 to n do
faktorial:=faktorial*i;
if rb4.Checked then
EdHasil.text:=floattostr(faktorial);
end;
procedure TForm1.rb5Click(Sender: TObject);
begin
begin
n:=strtoint(EdB.Text);
faktorial:=1;
for i:=2 to n do
faktorial:=faktorial*i;
if rb5.Checked then
EdHasil.text:=floattostr(faktorial);
end;
end;
procedure TForm1.rb6Click(Sender: TObject);
begin
a:=StrTofloat(EdA.text);
b:=StrTofloat(EdB.text);
c:=StrTofloat(EdC.text);
d:=StrTofloat(EdD.Text);
e:=exp(c * ln(d));
if rb6.Checked then
EdHasil.text :=floattoStr(e);
end;
procedure TForm1.rb7Click(Sender: TObject);
begin
a:=StrTofloat(EdA.text);
b:=StrTofloat(EdB.text);
c:=StrTofloat(EdC.text);
d:=StrTofloat(EdD.Text);
e:=exp(d * ln(a));
if rb7.Checked then
EdHasil.text :=floattoStr(e);
end;
procedure TForm1.rb1Click(Sender: TObject);
begin
a:=StrTofloat(EdA.text);
b:=StrTofloat(EdB.text);
c:=StrTofloat(EdC.text);
d:=StrTofloat(EdD.Text);
kb:=a;
if b> kb then kb:=b
else kb:=kb;
if c> kb then kb:=c
else kb:=kb;
if d> kb then kb:=d
else kb:=kb;
if rb1.Checked then
EdHasil.Text:=floattostr(kb);
end;
procedure TForm1.rb2Click(Sender: TObject);
begin
a:=StrTofloat(EdA.text);
b:=StrTofloat(EdB.text);
c:=StrTofloat(EdC.text);
d:=StrTofloat(EdD.Text);
kc:=a;
if b< kc then kc:=b
else kc:=kc;
if c< kc then kc:=c
else kc:=kc;
if d< kc then kc:=d
else kc:=kc;
if rb2.Checked then
EdHasil.Text:=floattostr(kc);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
a:=StrTofloat(EdAwal.text);
b:=StrTofloat(EdAkhir.text);
e:=b-a;
Edstep.Text:=floattostr(e);
Memo1.Lines.Add('Jumlah Bensin = '+FloatToStr(E));
f:=premium*e;
EdPremium.Text:=floattostr(f);
Memo2.Lines.Add('Total Harga Premium = '+FloatToStr(f));
g:=pertamax*e;
EdPertamax.Text:=floattostr(g);
Memo3.Lines.Add('Total Harga Pertamax = '+FloatToStr(g));
h:=solar*e;
EdSOlar.Text:=floattostr(h);
Memo4.Lines.Add('Total Harga Solar = '+FloatToStr(h));
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
EdAwal.Text:='';
EdAkhir.Text:='';
EdStep.Text:='';
EdPremium.Text:='';
EdPertamax.Text:='';
EdSolar.Text:='';
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
if(application.MessageBox('Yakin akan Keluar dari Program','Konfirmasi Ulang',MB_YesNo)=ID_Yes) then
begin
close;
end;
end;
end.
0 comments:
Post a Comment