0% found this document useful (0 votes)
17 views2 pages

Nama: Nadya Ds NIM: 12077283

This document contains code for a form that allows a user to select a phone model from a dropdown, view the phone name and price, calculate the total price with discounts, and display the change returned. It includes procedures to populate the dropdown, display phone details, calculate totals with 5% or 10% discounts, update returned change, and clear all fields.

Uploaded by

nalec
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views2 pages

Nama: Nadya Ds NIM: 12077283

This document contains code for a form that allows a user to select a phone model from a dropdown, view the phone name and price, calculate the total price with discounts, and display the change returned. It includes procedures to populate the dropdown, display phone details, calculate totals with 5% or 10% discounts, update returned change, and clear all fields.

Uploaded by

nalec
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

NAMA : NADYA DS

NIM : 12077283

procedure TForm2.FormCreate(Sender: TObject);


begin
combobox1.Items.Add (‘nka’);
combobox1.Items.Add (‘bb’);
combobox1.Items.Add (’se’);
end;

procedure TForm2.ComboBox1Click(Sender: TObject);


begin
if combobox1.Text=’nka’ then
  begin
  enama.Text :=’Nokia’;
  eharga.Text:=’2000000′;
  end
else
if combobox1.Text=’bb’ then
  begin
  enama.Text :=’Blackberry’;
  eharga.Text:=’6200000′;
  end
else
  begin
  enama.Text :=’Sony Ericsson’;
  eharga.Text:=’1500000′;
  end;
end;

procedure TForm2.rb1Click(Sender: TObject);


var c,a,d:real;
begin
if rb1.Checked =true then
  c:=strtofloat(eharga.Text);——->Tipe data String dirubah menjadi tipe data real/float
  a:=c*5/100;
  d:=a+c;
  etotbay.Text:=floattostr(d);
  ebayar.SetFocus
end;

procedure TForm2.rb2Click(Sender: TObject);


var c,a,d:real;
begin
if rb2.Checked =true then
  c:=strtofloat(eharga.Text);
  a:=c*10/100;
  d:=a+c;
  etotbay.Text:=floattostr(d);
  ebayar.SetFocus
end;
procedure TForm2.ebayarChange(Sender: TObject);
var a:real;
begin
a:=strtofloat(ebayar.Text)- strtofloat(etotbay.Text);
ekembali.Text:=floattostr(a);
end;

procedure TForm2.bbersihClick(Sender: TObject);


begin
combobox1.Text:=’Pilih Kode’;
enama.Text:=”;
eharga.Text:=’0′;
etotbay.Text:=’0′;
ebayar.Text:=’0′;
ekembali.Text :=’0′;
end; 

You might also like