Pages

Latihan 3 Struktur Data [Function]

Latihan 5 Pemrograman Visual

var
  Form1: TForm1;
  a,b,c,d,e:string;


procedure TForm1.ComboBox1Change(Sender: TObject);
begin
case Combobox1.ItemIndex of
0:begin
edit1.Text:='nama';
edit2.Text:='alamat';
edit3.Text:='umur';
edit4.Text:='status';
edit5.Text:='aaa';
end;
1:begin
a:='aaaa';
b:='bbbb';
c:='cccc';
d:='dddd';
e:='eeee';
end;
2:begin
a:='kkkk';
b:='llll';
c:='mmmm';
d:='nnnn';
e:='oooo';
end;
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
edit1.Text:='';
edit2.Text:='';
edit3.Text:='';
edit4.Text:='';
edit5.Text:='';
edit6.Text:='';
combobox1.ItemIndex:=-1;
radiogroup1.ItemIndex:=-1;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
edit1.Text:=a;
edit2.Text:=b;
edit3.Text:=c;
edit4.Text:=d;
edit5.Text:=e;
end;

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

procedure TForm1.RadioGroup1Click(Sender: TObject);
begin
Case RadioGroup1.ItemIndex of
0:begin
edit6.Text:='4';
end;
1:begin
edit6.Text:='5';
end;
2:begin
edit6.Text:='6';
end;
end;
end;
end.


Latihan 10 Sistem Basis Data

View
with thisform
.text5.value=.text1.text
.text6.value=.text2.text
.text7.value=.text3.text
.text8.value=.text4.text
Endwith

Close
thisform.release()

Renew
with thisform
.text1.value=""
.text2.value=""
.text3.value=""
.text4.value=""
.text5.value=""
.text6.value=""
.text7.value=""
.text8.value=""
Endwith

Hasil Run


Latihan 2 Struktur Data [procedure]

Procedure 1

Procedure 2





Materi SBD

Silahkan download
MATERI 1
MATERI 2

Latihan 4 Pemrograman Visual



var
  Form1: TForm1;
  a,b,c:real;

procedure TForm1.RadioGroup1Click(Sender: TObject);
begin
case radiogroup1.ItemIndex of
0:begin
a:=3500;
end;
1:begin
a:=4000;
end;
2:begin
a:=5000;
end;
end;
edit1.Text:=floattostr(a+b+c);
end;

procedure TForm1.CheckBox1Click(Sender: TObject);
begin
if CheckBox1.Checked then
b:=2000;
edit1.Text:=floattostr(a+b+c);
end;

procedure TForm1.Button1Click(Sender: TObject);
var
x,y,z:real;
begin
x:=strtofloat(edit1.text);
y:=strtofloat(edit2.Text);
z:=y-x;
edit3.text:=floattostr(z);
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
checkbox1.Checked:=false;
a:=0;
b:=0;
c:=0;
edit1.Text:='';
edit2.Text:='';
edit3.Text:='';
radiogroup1.ItemIndex:=-1;
end;

procedure TForm1.ComboBox1Change(Sender: TObject);
begin
case combobox1.ItemIndex of
0:begin
c:=1000;
end;
end;
edit1.text:=floattostr(a+b+c);
end;
end.

Hasil Run

Latihan 9 Sistem Basis Data

Text2

with thisform

.text3.value=val(.text1.text)*val(.text2.text)

Endwith



Check1

with thisform

.text4.value="Anda mendapat diskon 30%"

.text5.value=val(.text3.text)-val(.text3.text)*0.3

.text6.value=val(.text3.text)*0.3

.check2.enabled=.f.

.check3.enabled=.f.

Endwith



Check2

with thisform

.text4.value="Anda mendapat diskon 10%"

.text5.value=val(.text3.text)-val(.text3.text)*0.1

.text6.value=val(.text3.text)*0.1

.check1.enabled=.f.

.check3.enabled=.f.

Endwith



Check3

with thisform

.text4.value="Anda mendapat diskon 20%"

.text5.value=val(.text3.text)-val(.text3.text)*0.2

.text6.value=val(.text3.text)*0.2

.check1.enabled=.f.

.check2.enabled=.f.

Endwith



Mulai

with thisform

.text1.value=""

.text2.value=""

.text3.value=""

.text4.value=""

.text5.value=""

.text6.value=""

Endwith



Selesai

thisform.release()