LATIHAN 1
Objek
Form1
Label1
Label2
Label3
Edit1
Edit2
Button1
Button2
Button3
Properti
Nilai Properti
Caption
Latihan 1
Caption
DATA MAHASISWA
Font
Name: Tahoma, Size: 15,
Style: fsBold (True)
Caption
NAMA
Font
Name: Tahoma, Size: 12
Caption
ALAMAT
Font
Name: Tahoma, Size: 12
Text
(kosong)
Text
(kosong)
Caption
Proses
Caption
Hapus
Caption
Keluar
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes,
Graphics, Controls, Forms, Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Edit1: TEdit;
Edit2: TEdit;
1
Button1: TButton;
Button2: TButton;
Button3: TButton;
Label4: TLabel;
Label5: TLabel;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
[Link]:=[Link];
[Link]:=[Link];
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
[Link]:='';
[Link]:='';
[Link]:='';
[Link]:='';
[Link];
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
[Link];
end;
end.
LATIHAN 2
Objek
Form1
Label1
Label2
Label3
Label4
Label5
Edit1
Edit2
Button1
Button2
Button3
Button4
Button5
Button6
Button7
Button8
Properti
Nilai Properti
Caption
Latihan 2
Caption
DATA MAHASISWA
Font
Name: Tahoma, Size: 15,
Style: fsBold (True)
Caption
NAMA
Font
Name: Tahoma, Size: 12
Caption
ALAMAT
Font
Name: Tahoma, Size: 12
Caption
(kosong)
Caption
(kosong)
Text
(kosong)
Text
(kosong)
Caption
Proses
Caption
Verdana
Caption
Lucida
Caption
Ukuran 20
Caption
Merah
Caption
Biru
Caption
Normal
Caption
Keluar
unit Unit1;
interface
uses
3
Windows, Messages, SysUtils, Variants, Classes,
Graphics, Controls, Forms, Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Label2: TLabel;
Label3: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Label4: TLabel;
Label5: TLabel;
Button4: TButton;
Button5: TButton;
Button6: TButton;
Button7: TButton;
Button8: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button8Click(Sender: TObject);
procedure Button7Click(Sender: TObject);
procedure Button6Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
[Link]:=[Link];
4
[Link]:=[Link];
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
[Link];
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
[Link]:='verdana';
[Link]:='verdana';
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
[Link]:=20;
[Link]:=20;
end;
procedure TForm1.Button8Click(Sender: TObject);
begin
[Link]:='Ms sans serif';
[Link]:='Ms Sans Serif';
[Link]:=8;
[Link]:=8;
[Link]:=cldefault;
[Link]:=cldefault;
end;
procedure TForm1.Button7Click(Sender: TObject);
begin
[Link]:=clblue;
[Link]:=clblue;
end;
procedure TForm1.Button6Click(Sender: TObject);
begin
[Link]:=clred;
[Link]:=clred;
end;
procedure TForm1.Button5Click(Sender: TObject);
begin
[Link]:='Lucida handwriting';
[Link]:='Lucida handwriting';
5
end;
end.
LATIHAN 3
Objek
Form1
Label1
Button1
Button2
Button3
Properti
Nilai Properti
Caption
Latihan 3
Caption
Tombol Belum Ditekan
Font
Name: Tahoma, Size: 14,
Style: fsBold (True)
Caption
Belum ditekan
Caption
Belum direset
Enabled
False
Caption
Keluar
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes,
Graphics, Controls, Forms, Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Label1: TLabel;
Button3: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
7
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
[Link]:='Tombol Sudah Ditekan';
[Link]:='Belum Direset';
[Link]:='Sudah Ditekan';
[Link]:=false;
[Link]:=true;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
[Link]:=true;
[Link]:=false;
[Link]:='Belum Ditekan';
[Link]:='Sudah Direset';
[Link]:='Tombol Sudah Direset';
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
[Link];
end;
end.
LATIHAN 4
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes,
Graphics, Controls, Forms, Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Edit1: TEdit;
Edit2: TEdit;
ComboBox1: TComboBox;
ListBox1: TListBox;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Button1: TButton;
Button2: TButton;
procedure Edit1Change(Sender: TObject);
procedure Edit2Change(Sender: TObject);
procedure ComboBox1Change(Sender: TObject);
9
procedure ListBox1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Edit1Change(Sender: TObject);
begin
[Link]:=[Link];
end;
procedure TForm1.Edit2Change(Sender: TObject);
begin
[Link]:=[Link];
end;
procedure
TForm1.ComboBox1Change(Sender:
TObject);
begin
[Link]:=[Link];
end;
procedure TForm1.ListBox1Click(Sender: TObject);
begin
[Link]:=[Link][[Link]]
;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
[Link];
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
[Link]:='';
[Link]:='';
[Link]:='';
10
[Link]:='';
[Link]:='';
[Link]:='';
[Link];
end;
end.
11
LATIHAN 5
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes,
Graphics, Controls, Forms, Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
GroupBox1: TGroupBox;
GroupBox2: TGroupBox;
ck1: TCheckBox;
ck2: TCheckBox;
ck3: TCheckBox;
ck4: TCheckBox;
ck5: TCheckBox;
ck6: TCheckBox;
ck7: TCheckBox;
ck8: TCheckBox;
ck9: TCheckBox;
ck10: TCheckBox;
ck11: TCheckBox;
ck12: TCheckBox;
memo1: TMemo;
Button3: TButton;
12
procedure Button2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button2Click(Sender: TObject);
begin
[Link];
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
if [Link] or [Link] or [Link] or
[Link]
then [Link]([Link]);
if
[Link]
then
[Link]([Link]);
if
[Link]
then
[Link]([Link]);
if
[Link]
then
[Link]([Link]);
if
[Link]
then
[Link]([Link]);
[Link]('');
if [Link] or [Link] or [Link] or
[Link] or [Link] or [Link] or
[Link] or [Link] then
[Link]([Link]);
if
[Link]
then
[Link]([Link]);
if
[Link]
then
[Link]([Link]);
13
if
[Link]
then
[Link]([Link]);
if
[Link]
then
[Link]([Link]);
if
[Link]
then
[Link]([Link]);
if
[Link]
then
[Link]([Link]);
if
[Link]
then
[Link]([Link]);
if
[Link]
then
[Link]([Link]);
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
[Link]:=false;
[Link]:=false;
[Link]:=false;
[Link]:=false;
[Link]:=false;
[Link]:=false;
[Link]:=false;
[Link]:=false;
[Link]:=false;
[Link]:=false;
[Link]:=false;
[Link]:=false;
[Link];
end;
end.
14
LATIHAN 6
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes,
Graphics, Controls, Forms, Dialogs, StdCtrls, jpeg,
ExtCtrls;
type
TForm1 = class(TForm)
Button2: TButton;
Image1: TImage;
Label1: TLabel;
Button4: TButton;
Label2: TLabel;
Button1: TButton;
Button3: TButton;
procedure Button2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
15
implementation
{$R *.dfm}
procedure TForm1.Button2Click(Sender: TObject);
begin
[Link]('[Link]');
[Link]:=true;
[Link]:=false;
[Link]:=true;
[Link]:='Gambar 2';
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
[Link]('[Link]');
[Link]:=false;
[Link]:=true;
[Link]:=true;
[Link]:='Gambar 1';
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
[Link]('[Link]');
[Link]:=true;
[Link]:=true;
[Link]:=false;
[Link]:='Gambar 3';
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
[Link];
end;
end.
16
LATIHAN 7
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes,
Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls;
type
TForm1 = class(TForm)
rg1: TRadioGroup;
Edit1: TEdit;
Label1: TLabel;
Edit2: TEdit;
Button1: TButton;
Edit3: TEdit;
Button3: TButton;
Button2: TButton;
procedure rg1Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
a,b,c:real;
implementation
17
{$R *.dfm}
procedure TForm1.rg1Click(Sender: TObject);
begin
if [Link]=0 then
begin
[Link]:='X';
[Link]:='';
[Link]:='';
[Link]:='';
end else if [Link]=1 then
begin
[Link]:='+';
[Link]:='';
[Link]:='';
[Link]:='';
end else if [Link]=2 then
begin
[Link]:='-';
[Link]:='';
[Link]:='';
[Link]:='';
end else if [Link]=3 then
begin
[Link]:='/';
[Link]:='';
[Link]:='';
[Link]:='';
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
if [Link]=0 then
begin
a:=strtofloat([Link]);
b:=strtofloat([Link]);
c:=b*a;
[Link]:=floattostr(c);
end else if [Link]=1 then
18
begin
a:=strtofloat([Link]);
b:=strtofloat([Link]);
c:=b+a;
[Link]:=floattostr(c);
end else if [Link]=2 then
begin
a:=strtofloat([Link]);
b:=strtofloat([Link]);
c:=a-b;
[Link]:=floattostr(c);
end else if [Link]=3 then
begin
a:=strtofloat([Link]);
b:=strtofloat([Link]);
if b=0 then
begin messagedlg ('Goblok!!? 0 Tidak Bisa
Untuk Membagi',mtwarning,[mbOk],0);
[Link]:='';
[Link]:='';
[Link]:='';
end else
c:=a/b;
[Link]:=floattostr(c);
end;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
[Link];
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
[Link]:='';
[Link]:='';
[Link]:='';
end;
end.
19
20
LATIHAN 8
unit Unit12;
interface
uses
Windows, Messages, SysUtils, Variants, Classes,
Graphics, Controls, Forms, Dialogs, ExtCtrls,jpeg,
StdCtrls, ComCtrls;
type
TForm1 = class(TForm)
StatusBar1: TStatusBar;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Panel1: TPanel;
RichEdit1: TRichEdit;
Image1: TImage;
procedure Button2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
21
procedure Button3Click(Sender: TObject);
procedure Panel1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses Unit1, Unit3;
{$R *.dfm}
procedure TForm1.Button2Click(Sender: TObject);
begin
[Link]:=false;
[Link]:=true;
[Link]('[Link]');
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
[Link]:=true;
[Link]:=false;
[Link]('[Link]');
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
if messagedlg ('Anda yakin Akan Keluar ?',
mtConfirmation,mbOkCancel,0)
=mrOk then
[Link];
end;
procedure TForm1.Panel1Click(Sender: TObject);
begin
[Link];
end;
end.
unit Unit3;
22
interface
uses
Windows, SysUtils, Classes, Graphics,
Controls, StdCtrls, Buttons, ExtCtrls;
type
TAboutBox = class(TForm)
Panel1: TPanel;
ProgramIcon: TImage;
ProductName: TLabel;
Version: TLabel;
Copyright: TLabel;
Comments: TLabel;
OKButton: TButton;
Label1: TLabel;
private
{ Private declarations }
public
{ Public declarations }
end;
var
AboutBox: TAboutBox;
implementation
{$R *.dfm}
end.
Forms,
23
LATIHAN 9
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes,
Graphics, Controls, Forms, Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
label5: TLabel;
edit1: TEdit;
edit2: TEdit;
edit3: TEdit;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Label6: TLabel;
procedure Button3Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
24
{ Public declarations }
end;
var
Form1: TForm1;
n,p,t,v: real;
const
R=0.081;
implementation
{$R *.dfm}
procedure TForm1.Button3Click(Sender: TObject);
begin
[Link];
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
v:=strtofloat([Link]);
t:=strtofloat([Link]);
n:=strtofloat([Link]);
p:=(n*R*T)/v;
[Link]:=floattostr(p);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
[Link]:='';
[Link]:='';
[Link]:='';
[Link]:='';
end;
end.
25
LATIHAN 10
unit Ulat11;
interface
uses
Windows, Messages, SysUtils, Variants, Classes,
Graphics, Controls, Forms, Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
Edit1: TEdit;
Label2: TLabel;
Button1: TButton;
Button2: TButton;
procedure Button2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
x,y:real;
implementation
{$R *.dfm}
procedure TForm1.Button2Click(Sender: TObject);
26
begin
[Link];
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
y:=strtofloat([Link]);
x:=sqrt(y);
[Link]:='Akar dari ' + [Link] + '
adalah ' + floattostr(x);
[Link];
end;
end.
27
LATIHAN 11
unit Ulat12;
interface
uses
Windows, Messages, SysUtils, Variants, Classes,
Graphics, Controls, Forms, Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Edit1: TEdit;
Edit2: TEdit;
procedure Button3Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
28
end;
var
Form1: TForm1;
a,b,c:real;
implementation
{$R *.dfm}
procedure TForm1.Button3Click(Sender: TObject);
begin
[Link];
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
b:=strtofloat([Link]);
c:=strtofloat([Link]);
a:=exp(c*ln(b));
[Link]:=[Link];
[Link]:=[Link];
[Link]:=' = '+floattostr(a);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
[Link]:='';
[Link]:='';
[Link]:='';
[Link]:='';
[Link]:='';
[Link];
end;
end.
29
LATIHAN 12
unit Ulat13;
interface
uses
Windows, Messages, SysUtils, Variants, Classes,
Graphics, Controls, Forms, Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
30
public
{ Public declarations }
end;
var
Form1: TForm1;
n,i:byte;
m,a:real;
e:double;
const
h=6.62e-34;
ev=1.6e+19;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
n:=strtoint([Link]);
m:=strtofloat([Link]);
a:=strtofloat([Link]);
for i:=1 to n do
begin
e:=(sqr(h)*sqr(i))/(8*m*sqr(a));
e:=e*ev;
[Link]('Lintasan = ' +
inttostr(i) + ' maka E = '+floattostr(e)+ '
eV');
[Link]('');
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
[Link]:='';
[Link]:='';
[Link]:='';
[Link];
[Link];
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
31
[Link];
end;
end.
32
LATIHAN 13
unit Ulat14;
interface
uses
Windows, Messages, SysUtils, Variants, Classes,
Graphics, Controls, Forms, Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Label10: TLabel;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
Label14: TLabel;
Label15: TLabel;
Label16: TLabel;
Label17: TLabel;
33
Label18: TLabel;
Label19: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Button1: TButton;
Button2: TButton;
Button3: TButton;
procedure Button1Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
Var
Form1: TForm1;
a,b,c,d,e,f,g,h:real;
Const
ksp=1.8e-10;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
a:=strtofloat([Link]);
b:=strtofloat([Link]);
c:=strtofloat([Link]);
d:=strtofloat([Link]);
e:=a+c;
f:=b/e;
g:=d/e;
h:=f*g;
[Link]:=floattostr(a) + ' liter larutan
mengandung ' + floattostr(b) + ' mol Cl-';
[Link]:=floattostr(c) + ' liter larutan
mengandung ' + floattostr(d) + ' mol Ag+';
34
[Link]:='Volume campuran = ' +
floattostr(e) + ' liter';
[Link]:='[Cl-] = ' + floattostr(b) + '/' +
floattostr(e) + ' mol/liter = ' + floattostr(f) + '
mol/liter';
[Link]:='[Ag+] = ' + floattostr(d) + '/' +
floattostr(e) + ' mol/liter = ' + floattostr(g) + '
mol/liter';
[Link]:='[Ag+][Cl-] = ' + floattostr(f) + '
x ' + floattostr(g) + ' = ' + floattostr(h);
if h < ksp then
begin
[Link]:='Karena [Ag+][Cl-] < Ksp
maka AgCl tidak mengendap';
end else
[Link]:='Karena [Ag+][Cl-] > Ksp
maka AgCl mengendap';
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
[Link];
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
[Link]:='';
[Link]:='';
[Link]:='';
[Link]:='';
[Link]:='';
[Link]:='';
[Link]:='';
[Link]:='';
[Link]:='';
[Link]:='';
[Link]:='';
end;
end.
35
LATIHAN 14
unit Ugab3;
interface
uses
Windows, Messages, SysUtils, Variants, Classes,
Graphics, Controls, Forms, Dialogs, ExtCtrls, shellapi,
StdCtrls;
type
TForm1 = class(TForm)
Panel1: TPanel;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
RadioGroup1: TRadioGroup;
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure RadioGroup1Click(Sender: TObject);
36
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
Var
Form1: TForm1;
implementation
uses Unit2, Ugab2;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
[Link];
end;
procedure [Link](Sender: TObject);
begin
[Link]:=false;
[Link]:=false;
end;
procedure TForm1.RadioGroup1Click(Sender: TObject);
begin
if [Link]=0 then
begin
[Link]:=true;
[Link]:=true;
end else if [Link]=1 then
begin
[Link]:=true;
[Link]:=false;
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
[Link]:=false;
[Link]:=true;
end;
end.
unit Ugab2;
37
interface
uses
Windows, Messages, SysUtils, Variants, Classes,
Graphics, Controls, Forms, Dialogs, shellapi, StdCtrls,
ComCtrls;
type
TForm2 = class(TForm)
Button1: TButton;
Button2: TButton;
Button3: TButton;
Label1: TLabel;
Button4: TButton;
Button5: TButton;
Button6: TButton;
Button7: TButton;
RichEdit1: TRichEdit;
Button8: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure Button6Click(Sender: TObject);
procedure Button7Click(Sender: TObject);
procedure Button8Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
Var
Form2: TForm2;
implementation
uses Ugab1, Ugab3;
{$R *.dfm}
procedure TForm2.Button1Click(Sender: TObject);
begin
38
[Link];
end;
procedure TForm2.Button2Click(Sender: TObject);
begin
[Link]:=false;
[Link]:=true;
end;
procedure TForm2.Button3Click(Sender: TObject);
begin
[Link]:=false;
[Link]:=true;
end;
procedure TForm2.Button4Click(Sender: TObject);
begin
shellexecute(handle,'open','[Link]',nil,nil,sw
_show);
end;
procedure TForm2.Button5Click(Sender: TObject);
begin
shellexecute(handle,'open','[Link]',nil,nil,sw
_show);
end;
procedure TForm2.Button6Click(Sender: TObject);
begin
shellexecute(handle,'open','[Link]',nil,nil,sw
_show);
end;
procedure TForm2.Button7Click(Sender: TObject);
begin
shellexecute(handle,'open','[Link]',nil,nil,sw
_show);
end;
procedure TForm2.Button8Click(Sender: TObject);
begin
[Link]:=true;
[Link]('[Link]');
end;
procedure [Link](Sender: TObject);
begin
39
[Link]:=false;
end;
end.
40
LATIHAN 15
unit Ulatfilm;
interface
uses
Windows, jpeg, shellapi, mplayer,Messages, SysUtils,
Variants, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, ComCtrls, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Button3: TButton;
RichEdit1: TRichEdit;
Label1: TLabel;
StatusBar1: TStatusBar;
Image1: TImage;
Panel1: TPanel;
MediaPlayer1: TMediaPlayer;
Button4: TButton;
Button5: TButton;
Image2: TImage;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
41
procedure Button4Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
[Link]:=false;
[Link]:=false;
[Link]:=false;
[Link]:=false;
[Link]:=true;
[Link]('Data/[Link]');
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
[Link]:=false;
[Link]:=false;
[Link]:=true;
[Link]:=false;
[Link]:=false;
[Link]('Data/[Link]');
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
[Link]:=false;
[Link]:=false;
[Link]:=false;
[Link]:=true;
[Link]:=false;
[Link]:=false;
[Link]:=false;
[Link]:=false;
42
[Link]:='data/[Link]';
[Link];
[Link];
[Link]:=panel1;
[Link]:=rect(2,2,width,height);
[Link];
end;
procedure [Link](Sender: TObject);
begin
[Link]:=true;
[Link]:=false;
[Link]:=false;
[Link]:=false;
[Link]:=false;
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
[Link];
[Link]:=true;
[Link]:=true;
[Link]:=true;
[Link]:=false;
[Link]:=false;
[Link]:=true;
end;
procedure TForm1.Button5Click(Sender: TObject);
begin
if messagedlg ('Anda yakin akan keluar ?',
mtconfirmation, mbokcancel,0) = mrok then
[Link];
end;
end.
43
LATIHAN 16
unit ulatsoal;
interface
uses
Windows, shellapi, Messages, SysUtils, Variants,
Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls,
StdCtrls, ComCtrls;
type
TForm1 = class(TForm)
re1: TRichEdit;
Kalkulator: TButton;
SPU: TButton;
Label1: TLabel;
Waktu: TLabel;
Label3: TLabel;
A: TButton;
B: TButton;
C: TButton;
D: TButton;
Edit1: TEdit;
Ket1: TLabel;
Ket2: TLabel;
Mulai: TButton;
44
next: TButton;
keluar: TButton;
Timer: TTimer;
StatusBar1: TStatusBar;
procedure KalkulatorClick(Sender: TObject);
procedure SPUClick(Sender: TObject);
procedure keluarClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure MulaiClick(Sender: TObject);
procedure nextClick(Sender: TObject);
procedure AClick(Sender: TObject);
procedure BClick(Sender: TObject);
procedure CClick(Sender: TObject);
procedure TimerTimer(Sender: TObject);
procedure DClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
Var
Form1: TForm1;
xb,fni,js,jb,x:integer;
xs,fns,jss,jbs,filename:string;
implementation
{$R *.dfm}
procedure [Link](Sender: TObject);
begin
shellexecute(handle,'open','soal/[Link]',nil,nil,sw_
show);
end;
procedure [Link](Sender: TObject);
begin
shellexecute(handle,'open','soal/[Link]',nil,nil,sw_
show);
end;
procedure [Link](Sender: TObject);
begin
IF messagedlg ('Anda yakin Akan Keluar ?',
45
mtConfirmation,mbOkCancel,0)
=mrOk then
[Link];
end;
procedure [Link](Sender: TObject);
begin
[Link]:=false;
[Link]:=false;
[Link]:=false;
[Link]:=false;
[Link]:=false;
[Link]:=false;
[Link]:=false;
[Link]:=false;
[Link]:=false;
[Link]:=false;
[Link]:=false;
[Link]:=false;
end;
procedure [Link](Sender: TObject);
begin
[Link]:=true;
[Link]:=true;
[Link]:=true;
[Link]:=true;
[Link]:=true;
[Link]:=true;
[Link]:=true;
[Link]:=true;
[Link]:=true;
[Link]:=true;
[Link]:=true;
[Link]:=true;
[Link]:=false;
filename:='11';
[Link]('soal/'+filename+'.rtf');
js:=1;
jss:=inttostr(js);
[Link]:='Jumlah Soal : '+jss;
46
jb:=0;
jbs:=inttostr(jb);
[Link]:='Jumlah Benar : '+jbs;
[Link]:=true;
x:=0;
end;
procedure [Link](Sender: TObject);
begin
[Link]:='';
[Link]:=true;
[Link]:=true;
[Link]:=true;
[Link]:=true;
[Link]:=true;
js:=js+1;
fni:=strtoint(filename);
fni:=fni+1;
if fni>15 THEN
fni:=11;
fns:=inttostr(fni);
filename:=fns;
[Link]('soal/'+filename+'.rt
f');
jss:=inttostr(js);
[Link]:='Jumlah Soal: ' +jss;
if [Link]='Jumlah Soal: 5' then
[Link]:=false;
end;
procedure [Link](Sender: TObject);
begin
[Link]:=false;
[Link]:=false;
[Link]:=false;
[Link]:=false;
if filename='11' then
begin
[Link]:='Benar';
jb:=jb+1;
jbs:=inttostr(jb);
47
[Link]:='Jumlah Benar: '+jbs;
end else if filename='12' then
begin
[Link]:='Salah';
jb:=jb;
jbs:=inttostr(jb);
[Link]:='Jumlah Benar: '+jbs;
end else if filename='13' then
begin
[Link]:='Salah';
jb:=jb;
jbs:=inttostr(jb);
[Link]:='Jumlah Benar: '+jbs;
end else if filename='14' then
begin
[Link]:='Salah';
jb:=jb;
jbs:=inttostr(jb);
[Link]:='Jumlah Benar: '+jbs;
end else if filename='15' then
begin
[Link]:='Benar';
jb:=jb+1;
jbs:=inttostr(jb);
[Link]:='Jumlah Benar: '+jbs;
[Link]:=false;
end;
end;
procedure [Link](Sender: TObject);
begin
[Link]:=false;
[Link]:=false;
[Link]:=false;
[Link]:=false;
if filename='11' then
begin
[Link]:='Salah';
jb:=jb;
jbs:=inttostr(jb);
48
[Link]:='Jumlah Benar: '+jbs;
end else if filename='12' then
begin
[Link]:='Benar';
jb:=jb+1;
jbs:=inttostr(jb);
[Link]:='Jumlah Benar: '+jbs;
end else if filename='13' then
begin
[Link]:='Salah';
jb:=jb;
jbs:=inttostr(jb);
[Link]:='Jumlah Benar: '+jbs;
end else if filename='14' then
begin
[Link]:='Salah';
jb:=jb;
jbs:=inttostr(jb);
[Link]:='Jumlah Benar: '+jbs;
end else if filename='15' then
begin
[Link]:='Salah';
jb:=jb;
jbs:=inttostr(jb);
[Link]:='Jumlah Benar: '+jbs;
[Link]:=false;
end;
end;
procedure [Link](Sender: TObject);
begin
[Link]:=false;
[Link]:=false;
[Link]:=false;
[Link]:=false;
if filename='11' then
begin
[Link]:='Salah';
jb:=jb;
jbs:=inttostr(jb);
49
[Link]:='Jumlah Benar:
end else if filename='12' then
begin
[Link]:='Salah';
jb:=jb;
jbs:=inttostr(jb);
[Link]:='Jumlah Benar:
end else if filename='13' then
begin
[Link]:='Benar';
jb:=jb+1;
jbs:=inttostr(jb);
[Link]:='Jumlah Benar:
end else if filename='14' then
begin
[Link]:='Salah';
jb:=jb;
jbs:=inttostr(jb);
[Link]:='Jumlah Benar:
end else if filename='15' then
begin
[Link]:='Salah';
jb:=jb;
jbs:=inttostr(jb);
[Link]:='Jumlah Benar:
[Link]:=false;
end;
end;
'+jbs;
'+jbs;
'+jbs;
'+jbs;
'+jbs;
procedure [Link](Sender: TObject);
begin
x:=x+2;
xs:=inttostr(400-x);
[Link]:=xs+' detik';
xb:=strtoint(xs);
if xb=0 then
begin
[Link]:=true;
[Link]:=false;
50
[Link]:=false;
[Link]:=false;
[Link]:=false;
[Link]:=false;
x:=-1;
[Link];
[Link]:=false;
[Link]:='400';
jb:=0;
js:=0;
end;
end;
procedure [Link](Sender: TObject);
begin
[Link]:=false;
[Link]:=false;
[Link]:=false;
[Link]:=false;
if filename='11' then
begin
[Link]:='Salah';
jb:=jb;
jbs:=inttostr(jb);
[Link]:='Jumlah Benar: '+jbs;
end else if filename='12' then
begin
[Link]:='Salah';
jb:=jb;
jbs:=inttostr(jb);
[Link]:='Jumlah Benar: '+jbs;
end else if filename='13' then
begin
[Link]:='Salah';
jb:=jb;
jbs:=inttostr(jb);
[Link]:='Jumlah Benar: '+jbs;
end else if filename='14' then
begin
[Link]:='Benar';
51
jb:=jb+1;
jbs:=inttostr(jb);
[Link]:='Jumlah Benar: '+jbs;
end else if filename='15' then
begin
[Link]:='Salah';
jb:=jb;
jbs:=inttostr(jb);
[Link]:='Jumlah Benar: '+jbs;
[Link]:=false;
end;
end;
end.
52