Anda di halaman 1dari 3

unit Unit6; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls;

type TForm1 = class(TForm) Label1: TLabel; Label2: TLabel; Label3: TLabel; Label4: TLabel; eno: TEdit; enapem: TEdit; ckode: TComboBox; Label5: TLabel; Label6: TLabel; Label7: TLabel; enabar: TEdit; eharga: TEdit; ejumbel: TEdit; RadioGroup1: TRadioGroup; rtunai: TRadioButton; rkredit: TRadioButton; Button1: TButton; exit: TButton; Label8: TLabel; ediskon: TEdit; hitung: TButton; Label9: TLabel; Label11: TLabel; Label12: TLabel; esubtotal: TEdit; eubay: TEdit; eukem: TEdit; Label10: TLabel; etobay: TEdit; procedure FormCreate(Sender: TObject); procedure ckodeChange(Sender: TObject); procedure ejumbelKeyPress(Sender: TObject; var Key: Char); procedure rtunaiClick(Sender: TObject); procedure rkreditClick(Sender: TObject); procedure hitungClick(Sender: TObject); procedure eubayChange(Sender: TObject); procedure exitClick(Sender: TObject); procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject); begin ckode.Items.Add('GTR'); ckode.Items.Add('BIO'); ckode.Items.Add('PIA'); end; procedure TForm1.ckodeChange(Sender: TObject); begin if(ckode.Text='GTR') then begin enabar.text :='Gitar'; eharga.Text :='1500000'; end else if(ckode.text='BIO') then begin enabar.text :='Biola'; eharga.Text :='2500000'; end else if(ckode.text='PIA') then begin enabar.text :='Piano'; eharga.Text :='3500000'; end

end; procedure TForm1.ejumbelKeyPress(Sender: TObject; var Key: Char); var a,b,c:real; begin if key=#13then begin a:=strtofloat(ejumbel.Text); b:=strtofloat(eharga.Text); c:=a*b; esubtotal.Text:=floattostr(c); end end; procedure TForm1.rtunaiClick(Sender: TObject); var a,b:real; begin a:=strtofloat(esubtotal.Text); b:=0.1*a; ediskon.Text:=floattostr(b); end; procedure TForm1.rkreditClick(Sender: TObject); var a,b:real; begin a:=strtofloat(esubtotal.Text);

b:=0*a; ediskon.Text:=floattostr(b); end; procedure TForm1.hitungClick(Sender: TObject); var a,b,c:real; begin a:=strtoint(esubtotal.Text); b:=strtoint(ediskon.Text); c:=a-b; etobay.Text:=floattostr(c); end; procedure TForm1.eubayChange(Sender: TObject); begin eukem.Text:=floattostr(strtoint(eubay.Text)-strtoint(etobay.Text)); end; procedure TForm1.exitClick(Sender: TObject); begin if(application.messagebox(' Yakin Mau keluar..???','konfirmasi',mb_yesno+31)=idy es)then close; end; procedure TForm1.Button1Click(Sender: TObject); begin eno.Text:=''; enapem.Text:=''; ckode.Text:='-PILIH'; enabar.text:=''; eharga.Text:='0'; ejumbel.Text:='0'; esubtotal.Text:='0'; rtunai.Checked:=false; rkredit.Checked:=false; ediskon.Text:='0'; etobay.Text:='0'; eubay.Text:='0'; eukem.Text:='0'; eno.SetFocus; end; end.