Buat Terlebih dahulu
Label 1 diberi caption Umur
Label2 diberi caption “” (tidak diisi)
Edit1 diberi text “” (tidak diisi)
Button1 diberi caption proses
Button2 diberi caption keluar
Coding pada button proses
Procedure TForm1. Button1Click(Sender: TObject) ;
var usia: integer;
Begin
Usia: =StrToInt(Edit1.text) ;
Case usia of
0..5: Label2.caption: = ‘Balita’;
6..10: Label2.caption: = ‘Anak-anak’;
11..20: Label2.caption: = ‘Remaja’;
21..40: Label2.caption: = ‘Pemuda’;
41..60: Label2.caption: = ‘Orang Tua’;
61..100: Label2.caption: = ‘Lansia’;
Else
Label2.caption:= ‘Anda berumur panjang’;
End;
End;
var usia: integer;
Begin
Usia: =StrToInt(Edit1.text) ;
Case usia of
0..5: Label2.caption: = ‘Balita’;
6..10: Label2.caption: = ‘Anak-anak’;
11..20: Label2.caption: = ‘Remaja’;
21..40: Label2.caption: = ‘Pemuda’;
41..60: Label2.caption: = ‘Orang Tua’;
61..100: Label2.caption: = ‘Lansia’;
Else
Label2.caption:= ‘Anda berumur panjang’;
End;
End;
end.
Coding pada button keluar
procedure TForm1.Button2Click(Sender:TObject);
Begin
Application.terminate;
end;
end.