Top Banner
TUGAS 1 PEMROGRMAN VISUAL 1 NIM: C1457201009 NAMA : HERMANTO KELAS : SI-A DOSEN : Ferdiyani haris,S.Kom
76

hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

Aug 02, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

TUGAS 1PEMROGRMAN VISUAL 1

NIM: C1457201009NAMA : HERMANTO

KELAS : SI-ADOSEN : Ferdiyani haris,S.Kom

SEKOLAH TINGGI MANAJEMEN INFORMATIKA DAN KOMPUTER

(STMIK) PALANGKA RAYA

Page 2: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

Mengenal Delphi 1. Pengertian Delphi

Delphi adalah suatu bahasa pemograman (development language) yang digunakan untk merancang suatu aplikasi program. a. Kegunaan Delphi

1. ntuk membuat aplikasi windows 2. Untuk merancang aplikasi program berbasis grafis 3. Untuk membuat program berbasis jaringan (client/server) 4. Untuk merancang program .Net (berbasis internet)

b. Keunggulan Delphi 1. IDE (Integrated Development Environment) ataulingkungan pengembangan

aplikasi sendiri adalah satu dari beberapa keunggulan delphi, didalamnya terdapat menu – menu yang memudahkan kita untuk membuat suatu proyek program.

2. Proses Kompilasi cepat, pada saat aplikasi yang kita buat dijalankan pada Delphi, maka secara otomatis akan dibaca sebagai sebuah program, tanpa dijalankan terpisah.

3. Mudah digunakan, source kode delphi yang merupakan turunan dari pascal, sehingga tidak diperlukan suatu penyesuain lagi.

4. Bersifat multi purphase, artinya bahasa pemograman Delphi dapat digunakan untuk mengembangkan berbagai keperluan pengembangan aplikasi.

c. Sejarah Borland Delphi 1. Delphi versi 1 (berjalan pada windows 3.1 atau windows 16 bit)2. Delphi versi 2 (Berjalan pada windows 95 atau delphi 32 bit)3. Delphi versi 3 (berjalan pada windows 95 keatas dengan tambahan fitur

internet atua web) 4. Perkembangan selanjutnya diikuti dengan Delphi versi 4, 5 dan 6.

Versi terkini dari delphi adalahversi 7 dengan tambahan vitur .net dengan tambahan file XML .

2. OOP (Object Oriented Programming)OOP adalah metode pemograman dengan membentu sebuahaplikasi yang mendekati keadaan dunia yang sesungguhnya. Hal itu bisa dilakukan dengan cara mendisain object untuk menyelesaikan masalah. a. Tiga unsur OOP

Encapsulation atau pemodelan Encapsulation adalah konsep penggabungan data dengan operator. Dalam konsep pemodelan data dan operasi menjadi satu kesatuan yang disebut object. Encapsulationjuga disebut dengan penyembunyian informasi (information hiding)

Contoh = ketika kita menyalakan sebuah TV kita tidak tahu apa yang terjadi dengan proses dan percakapan antar alat yang berhub ungan dengan TV tersebut sehingga mampu menampilkan sebuah gambar.

Page 3: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

Atau= ketika melakukan klik pada subuah object dalam suatu aplikasi program kita tidak tahu apa yang dilakukan program sehingga ditampilkan hasil yang sesuai.

Catatan = dari dua contoh kasus tersebut terdapat kesamaan proses mengenai information hidingyang tidak diketahui oleh user sampai hasil ditampilkan.

b. Inheritance atau penurunan Inherintance adalah sebuah object yang dapat diturunkan menjadiobject yang baru dengan tidak menghilangkan sifat asli dari object tersebut.

Contoh = TV merupakan salah satu media elektronik yang dgunakan untuk menampilkan gambar dengan tujuan untuk memberikan informasi kepada konsumen. Secara umum TV memunyai cara kerja yang sama dengan media elektronik yang lain dlam proses penyampaian informasi, tetapi mempunyai sifat yang unik yang dapat membedakan dengan media electronik yang ada. Atau = Dalam aplikasi program kita sering menggunakan command button, untuk beberapa perintah yang berbeda.

c. Polymorphism atau Polimorfisme Polymorphismmerupakan penggunaan berbagai macam object yang berbeda tetapi secara fungsi bergantung pada satu object sebagai induk, dengan cara pelaksanaan yang berbeda – beda.

Contoh = TV dan radio adalah media electronik yang mempunyai sistem yang sama tentang bagaimana meyebarkan suatu informasi, tetapi cara kerja dari masing – masing sistem pasti berbeda.

Atau Object Simpan dan Update adalah icon yang berasal dari induk yang sama yaitu , command button tetapi cara kerja tersebut berbeda– beda.

3. Delphi dan OOP (Object Oriented Programming) Secara default ketika kita merancang suatu aplikasi program, mau tidak mua dan tanpa kita sadari bahwa kita telah menerapkan OOP, walupun secara teori kita kurang memahami OOP dalam arti yang sebenarnya. Contoh sederhananya adalah ketika kita merancang suatu form (Tform1) baru, sadar atau tidak sebenarnya form yang kita aktifkan merupakan turunan dari Tform sebagai induknya atau ketika kita mengaktikan button pada form merupakan turunan dari tbutton.

Page 4: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

Atau Contoh dalam bahasa program adalah sebagai berikut = ketika merancang suatu label di form secara otomatis delphi akan menuliskan label tersebut dalam jendela code editor tentang turunan dari label tersebut.Type

Tform = class(tform) Label1 = tlabel

End;

4. IDE DELPHI a. langkah – langkah mengaktifkan Delphi

a. Klik startb. pilih program Files c. pilih Borland Delphi d. pilih dan klik Delphi 7

b. Jendela Utama Delphi

Gambar 1.1 jendela utama Delphi

c. Bagian – bagian dari Jendela Delphi

1. Object Tree View Merupakan sebuah diagram pohon yang menggambarkan hubungan logismenghubungkan semua komponen yang terdapat dalam suatu proyek program. Komponen tersebut meliputi form, modul atau frame. Fungsinyadigunakan untuk menampilkan seluruh daftar komponenprogram dalm sebuah aplikasi program sesuai dengan penempatnnya.

Gamabar 1.2 jendela tree view

Page 5: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

2. Object Inspector Merupakan jendela yang digunakan utnuk mengatur tampilan komponen pada form, misal bagaimana mengubah tulisan button pada command button menjadi Simpan, atau menghapus tulisan pada label dan mengganti nama menjadi Nama Mahasiswa atau memberikan perintah tertentu pada sebuah komponen sehingga ada interaksi ketika program dijalankan..

Secara Umum Object Inspector terbagi menadi 2, yaitu = a. Properties

Digunakan untuk mengatur tampilan pada sebuah komponen baik itu meliputi penggantian nama, warna, jenis huruf, border dan lain –lain.

Gambar 1.3 jendela inspctor(properties)b. Events Merupakan jendela properties yang digunakan untuk memberikan fungsi yang lebih detail dari fungsi sebenarnya. Misalnya ketika tombol Simpan di klik maka program akan menjalankan perintah penyimpanan data. Dari kalimat tersebut ada event clik untuk mengeksekusi sebuah tombol simpan. Perintah event clik tersebut dapat diberikan melalui jendela events.

Page 6: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

Gambar 1.4 jendela Events pada Object inspector

3. Form Designer Merupakan tempat yang digunakan untuk merancang semua aplikasi program yang diambil dari komponen pallete.

Gambar 1.5 jendela from desinger

4. Component Pallete Merupakan kumpulan icon yang digunakan untuk merancang suatu aplikasi pada untuk membentuk sebuah aplikasi user interface. Dalam komponen pallete semua icon dikelompokan dalam berbagai komponen sesuai dengan fungsi dan kegunaannya.

Gambar 1.6 jendela Kumponen pallete

Page 7: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian
Page 8: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

5. Code Editor Bagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian paling kiri yang berisi berupa angkamenunjukan baris dan kolom. Keterangan modifiedmenunjukan bahwa telah terjadi modifikasi terhapap baris program. Dan paling kanan menunjukan status keyboard tentang tombol insertatau over write.

Gambar 1.7 jendela code editor

6. Code Explorer Jendela yang digunakan untuk menampilkan seluruh variabel, type, dan rountine yang didefinisikan pada sebuah unit.

Gamabar 1.8 jendela explorer

Page 9: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

7. Code Diagram Merupakan fasilitas pada delphi yang digunakan untuk mendesain sebuah diagram atas komponen – komponen yang digunakan dalam seatu rancangan aplikasi.

Gambar1.9 jendela code diagram

d. Proyek Delphi 1. File Proyek

File ini disimpan dengan ber-ekstenion .dpr. File ini berisi informasi mengenai seluruh proyek program

2. File Unit File ini merupakan kumpulan dari barisan kode program yang terdapat di jendela code editor, baik itu yang dituliskan oleh progremmer maupun oleh system. Extention file ini adalah . pas File Unit dibagi menjadi 2

a.Bagian Interface Barisan ini dimulai dari kata Interface (setelah nama unit), berisi seluruh deklarasi variabel, tipe data object maupun deklarasi tambahan.

b.Bagian Implementation Dimulai dari kata kunci implementation dan diakhiri dengan kata end.Fungsi digunakan untuk menuliskan kode program sebagai bagain dari interaksi antar komponen ataupun dengan user.

3. File Form Berisi tentang seluruh informasi yang ada kaitannyadengan form yang dibuat, meliputi tinggi, lebar, pososi form atau tentang komponen didalmnya. Penggunaan file ini tidak dianjurkan karena untu pengaturan sudah disediakan object inspector sebagai media pengaturan semua komponen.

Page 10: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

5. Aplikasi (latihan 1)a. Hasil Program

Gambar 1.10 gambar form b. Deasin form

Gambar 1.11 Gambar desain form

c. Desain properties

Object name Captionbutton1 Button1 Button1Button2 Button2 Button2Button3 Button3 ExitEdit1 Edit1 Edit1Label1 Label1 Text

Page 11: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

d. Listing program1. Ketika form dalam keadaan aktif maka form akan menampilkan edit

pembuat program

procedure TForm1.Edit1Change(Sender: TObject);beginlabel1.caption:=edit1.text;end;

2.Untuk keluaran dari program user mengklik button close

procedure TForm1.Button3Click(Sender: TObject);beginclose;end;

latihan 1 dan 2

Object name caption EventsButton1 Button1 Pesan1Button2 Button2 HapusButton3 Button3 CloseButton4 Button4 OkButton5 Button5 TampilEdit1 Edit1Edit2 Edit2Edit3 Edit3Edit4 Edit4Combobox1 Combobox1

Page 12: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

Label1 Label1

procedure TForm1.Button1Click(Sender: TObject);beginForm1.Color:=clgreen;Edit2.Text:=Edit1.Text;Edit3.Text:=Edit1.Text;end;procedure TForm1.Button3Click(Sender: TObject);beginclose;end;

procedure TForm1.Button2Click(Sender: TObject);beginEdit1.Text:='';Edit2.Text:='';Edit3.Text:='';end;

procedure TForm1.Edit3Change(Sender: TObject);beginedit3.text:=edit3.text;end;

procedure TForm1.Edit2Change(Sender: TObject);beginedit1.text:=edit1.text;end;

procedure TForm1.Button4Click(Sender: TObject);beginEdit4.Text:=ComboBox1.text;end;

procedure TForm1.Button5Click(Sender: TObject);beginIf ComboBox1.Text='Jekan Raya 'thenbegin Edit4.Text:='25000'; Form1.color:=clred; Label1.Caption:='Selamat Anda Mendapatkan Tiket Ke Jekan Raya';end;If ComboBox1.Text='Pahandut'thenbegin Edit4.Text:='30000'; Form1.color:=clyellow; Label1.Caption:='Selamat Anda Mendapatkan Tiket Ke Pahandut';end;

Page 13: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

If ComboBox1.Text='Palangkaraya'thenbegin Edit4.Text:='75000'; Form1.color:=clblue; Label1.Caption:='Selamat Anda Mendapatkan Tiket Ke Palangkaraya';end;end;

latihan 3

Object name Caption EventsButton1 Button1 Ok ifButton2 Button2 Ok ifButton3 Button3 HapusRadiobutton1 Radiobutton1 SurabayaRadiobutton2 Radiobutton2 MalangRadiobutton3 Radiobutton3 BaliRadiogroup1 Radiogroup1 Item(a,b,c,d)Edit1 Edit1 Edit1Edit2 Edit2 Edit2

procedure TForm1.Button1Click(Sender: TObject);begin if radiobutton1.checked=true then edit1.text:='100000' else if radiobutton2.checked=true then edit1.text:='200000' else if radiobutton3.checked=true then edit1.text:='300000' else showmessage ('Anda Belum Menentukan Pilihan');end;

Page 14: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

procedure TForm1.Button2Click(Sender: TObject);beginif radiogroup1.itemindex= 0 then edit2.text:='100000' else if radiogroup1.itemindex=1 then edit2.text:='200000' else if radiogroup1.itemindex= 2 then edit2.text:='300000' else if radiogroup1.itemindex= 3 then edit2.text:='400000'end;

procedure TForm1.Button3Click(Sender: TObject);begincase radiogroup1.ItemIndex of0:edit2.Text:='100000';1:edit2.Text:='200000';2:edit2.Text:='300000';3:edit2.Text:='400000';end;end;

latihan 4

Object name Caption EventsEdit1 Edit1Edit2 Edit2Edit3 Edit3

Page 15: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

Edit4 Edit4Edit5 Edit5Edit6 Edit6Edit7 Edit7Button1 Button1 HitungButton2 Button2 HapusButton3 Button3 CloseButton4 Button4 HitungButton5 Button5 HitungButton6 Button6 HapusButton7 Button7 HapusRadiobutton1 Radiobutton1 BukuRadiobutton2 Radiobutton2 PensilRadiobutton3 Radiobutton3 KertasRadiogroup1 Radiogroup1 Pilih menu

Items(buku,kertas,pensil)

Groupbox1 Groupbox1

procedure TForm1.Button2Click(Sender: TObject);beginedit1.Text:='0';edit2.Text:='0';end;

procedure TForm1.Button1Click(Sender: TObject);var kode,banyak,bayar : real;begin banyak:=strtofloat(edit2.Text); Case strtoint(edit1.Text) of 1:kode:=1000; 2:kode:=2000; 3:kode:=3000; end; bayar:=banyak*kode; edit3.Text:=floattostr(bayar); end; procedure TForm1.Button3Click(Sender: TObject);beginclose;end;

procedure TForm1.Button5Click(Sender: TObject);var harga,banyak,bayar : real;beginbanyak:=strtofloat(edit4.Text);if radiobutton1.Checked then harga:=10000;

Page 16: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

if radiobutton2.Checked then harga:=20000;if radiobutton3.Checked then harga:=30000;bayar:=banyak*harga;edit5.Text :=floattostr(bayar);end;

procedure TForm1.Button6Click(Sender: TObject);beginedit4.Text:='0';edit5.Text:='0';end;

procedure TForm1.Button4Click(Sender: TObject);var harga,banyak,bayar : real;begin banyak:=strtofloat(edit6.Text); case radiogroup1.ItemIndex of 0:begin harga:=10000; form1.Color :=clgreen; label11.Caption :='Terimakasih Telah membeli Buku'; end; 1:begin harga:=20000; form1.Color :=clred; label11.Caption :='Terimakasih Telah membeli kertas'; end; 2:begin harga:=30000; form1.Color :=clyellow; label11.Caption :='Terimakasih Telah membeli pensil'; end; end; bayar:=banyak*harga; edit7.Text :=floattostr(bayar);end;

procedure TForm1.Button7Click(Sender: TObject);beginedit6.Text:='0';edit7.Text:='0';end;

Page 17: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

latihan 5

Object name Caption EventsBitbtn1 Bitbtn1 Kind(bkok)Bitbtn2 Bitbtn2 Kind(bkRetry)Bitbtn3 Bitbtn3 Kind(bkClose)Radiogroup Radiogroup Items(paket A,paket

B,paket C)Edit1 Edit1Edit2 Edit2Edit3 Edit3Label1 Label1

procedure TForm1.BitBtn1Click(Sender: TObject);beginif radiogroup1.itemindex= 0 then begin edit1.Text:='100000'; edit2.Text:='200000'; edit3.Text:='300000'; label1.caption:='600000'; end; if radiogroup1.itemindex=1 then begin edit1.Text:='200000'; edit2.Text:='300000'; edit3.Text:='300000'; label1.caption:='800000'; end; if radiogroup1.itemindex= 2 then begin edit1.Text:='500000';

Page 18: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

edit2.Text:='600000'; edit3.Text:='400000'; label1.caption:='1500000'; end; end;procedure TForm1.BitBtn2Click(Sender: TObject);begin edit1.Text:='0'; edit2.Text:='0'; edit3.Text:='0'; label1.caption:='Total';end;

latihan 6

Object name Caption EventsEdit1 Edit1Edit2 Edit2Edit3 Edit3Edit4 Edit4Edit5 Edit5Edit6 Edit6Button1 Button1 *Button2 Button2 +Button3 Button3 /Button4 Button4 -Button5 Button5 HasilButton6 Button6 KeluarRadiogroup1 Radiogroup1 Items(*,+,/,-)

var a,b,c :real;procedure TForm1.Button1Click(Sender: TObject);begina:=strtofloat(edit1.Text);b:=strtofloat(edit2.Text);

Page 19: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

c:=a*b;edit3.Text :=floattostr(c);end;procedure TForm1.Button2Click(Sender: TObject);begina:=strtofloat(edit1.Text);b:=strtofloat(edit2.Text);c:=a+b;edit3.Text :=floattostr(c);end;procedure TForm1.Button3Click(Sender: TObject);begina:=strtofloat(edit1.Text);b:=strtofloat(edit2.Text);c:=a/b;edit3.Text :=floattostr(c);end;procedure TForm1.Button4Click(Sender: TObject);begina:=strtofloat(edit1.Text);b:=strtofloat(edit2.Text);c:=a-b;edit3.Text :=floattostr(c);end;procedure TForm1.Button5Click(Sender: TObject);begina:=strtofloat(edit4.Text);b:=strtofloat(edit5.Text);case radiogroup1.ItemIndex of 0:begin c:=a*b; edit6.Text :=floattostr(c); end; 1:begin c:=a+b; edit6.Text :=floattostr(c); end; 2:begin c:=a/b; edit6.Text :=floattostr(c); end; 3:begin c:=a-b; edit6.Text :=floattostr(c);

Page 20: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

end; end; end;procedure TForm1.Button6Click(Sender: TObject);beginclose;end;

latihan 7

Object name Caption EventsEdit1 Edit1Edit2 Edit2Edit3 Edit3Edit4 Edit4Edit5 Edit5Edit6 Edit6Edit7 Edit7Edit8 Edit8Button1 Button1 HasilButton2 Button2 HapusButton3 Button3 KeluarLabel1 Label1 Label1Label2 Label2 Label2

varTugas,Uts,Uas, Praktek, Hasil, Hasil1,Hasil2,Hasil3,Hasil4: Real;procedure TForm1.Edit1Change(Sender: TObject);beginTugas:=strtofloat(Edit1.Text);

Page 21: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

Hasil1:=(Tugas*20)/100;Edit5.Text:=Floattostr(Hasil1);end;

procedure TForm1.Edit2Change(Sender: TObject);beginPraktek:=strtofloat(Edit2.Text);Hasil2:=(Praktek*25)/100;Edit6.Text:=Floattostr(Hasil2);end;

procedure TForm1.Edit3Change(Sender: TObject);beginUts:=strtofloat(Edit3.Text);Hasil3:=(Uts*25)/100;Edit7.Text:=Floattostr(Hasil3);end;

procedure TForm1.Edit4Change(Sender: TObject);beginUas:=strtofloat(Edit4.Text);Hasil4:=(Uas*35)/100;Edit8.Text:=Floattostr(Hasil4);end;

procedure TForm1.Button1Click(Sender: TObject);beginHasil:=Hasil1+Hasil2+Hasil3+Hasil4;edit10.Text:=Floattostr(Hasil);if Hasil =0 thenbeginLabel1.Caption:='E';Label2.Caption:='Gagal';endelseif Hasil >=80 thenbeginLabel1.Caption:='A';Label2.Caption:='Sangat Baik';endelseif Hasil >=70 thenbeginLabel1.Caption:='B';

Page 22: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

Label2.Caption:='Baik';endelseif Hasil >=60 thenbeginLabel1.Caption:='C';Label2.Caption:='Cukup Baik';endelseif Hasil <=60 thenbeginLabel1.Caption:='D';Label2.Caption:='Kurang Baik';end;end;

procedure TForm1.Button2Click(Sender: TObject);beginEdit1.Text:='0';Edit2.Text:='0';Edit3.Text:='0';Edit4.Text:='0';Edit5.Text:='0';Edit6.Text:='0';Edit7.Text:='0';Edit8.Text:='0';Edit9.Text:='0';end;

procedure TForm1.Button3Click(Sender: TObject);beginclose;end;

Page 23: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

latihan 8

Object name Caption EventsEdit1 Edit1Edit2 Edit2Edit3 Edit3Edit4 Edit4Edit5 Edit5Edit6 Edit6Edit7 Edit7Edit8 Edit8ListBox1 ListBox1ComboBox1 ComboBox1CheckBox1 CheckBox1 PMICheckBox2 CheckBox2 DENDAButton1 Button1 HitungButton2 Button2 LagiButton3 Button3 SelesaiRadioGroup1 RadioGroup1 Jenis Pelanggan

Items(sosial.rumah tangga,bisnis)

Var l:string;procedure TForm1.FormCreate(Sender: TObject);begin

Page 24: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

listbox1.Clear;listbox1.Items.add('S1');listbox1.Items.add('S2');combobox1.Clear;combobox1.Items.add('450');combobox1.Items.add('900');combobox1.Items.add('1200');edit1.Text:='110';combobox1.Text:=combobox1.Items[0];edit5.Enabled:=false;edit6.Enabled:=false;end;

procedure TForm1.RadioGroup1Click(Sender: TObject);begincase radiogroup1.ItemIndex of 0:begin listbox1.Clear; listbox1.Items.add('S1'); listbox1.Items.add('S2'); combobox1.Clear; combobox1.Items.add('450'); combobox1.Items.add('900'); combobox1.Items.add('1200'); combobox1.Text:=combobox1.Items[0]; edit1.Text:='110'; end; 1:begin listbox1.Clear; listbox1.Items.add('r1'); listbox1.Items.add('r2'); combobox1.Clear; combobox1.Items.add('450'); combobox1.Items.add('900'); combobox1.Items.add('1200'); combobox1.Text:=combobox1.Items[0]; edit1.Text:='120'; end; 2:begin listbox1.Clear; listbox1.Items.add('b1'); listbox1.Items.add('b2'); combobox1.Clear; combobox1.Items.add('2200');

Page 25: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

combobox1.Items.add('3300'); combobox1.Items.add('5000'); combobox1.Text:=combobox1.Items[0]; edit1.Text:='400';end;end;end;procedure TForm1.ListBox1Click(Sender: TObject);begincase listbox1.ItemIndex of 0:begin case radiogroup1.ItemIndex of 0:begin combobox1.Clear; combobox1.Items.add('450'); combobox1.Items.add('900'); combobox1.Items.add('1200'); combobox1.Text:=combobox1.Items[0]; edit1.Text:='110'; end; 1:begin combobox1.Clear; combobox1.Items.add('450'); combobox1.Items.add('900'); combobox1.Items.add('1200'); combobox1.Text:=combobox1.Items[0]; edit1.Text:='120'; end; 2:begin combobox1.Clear; combobox1.Items.add('2200'); combobox1.Items.add('3300'); combobox1.Items.add('5000'); combobox1.Text:=combobox1.Items[0]; edit1.Text:='400'; end; end; l:=listbox1.items[0]; end; 1:begin case radiogroup1.ItemIndex of 0:begin combobox1.Clear; combobox1.Items.add('900');

Page 26: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

combobox1.Items.add('1200'); combobox1.Items.add('2200'); combobox1.Text:=combobox1.Items[0]; edit1.Text:='120'; end; 1:begin combobox1.Clear; combobox1.Items.add('900'); combobox1.Items.add('1200'); combobox1.Items.add('2200'); combobox1.Text:=combobox1.Items[0]; edit1.Text:='150'; end; 2:begin combobox1.Clear; combobox1.Items.add('3300'); combobox1.Items.add('5000'); combobox1.Items.add('10000'); combobox1.Text:=combobox1.Items[0]; edit1.Text:='500'; end; end; l:=listbox1.items[1];end;end;end;procedure TForm1.ComboBox1Change(Sender: TObject);beginif(l='S1')and (combobox1.Text='450')then edit1.Text:='110';if(l='S1')and (combobox1.Text='900')then edit1.Text:='120';if(l='S1')and (combobox1.Text='1200')then edit1.Text:='250';

if(l='S2')and (combobox1.Text='900')then edit1.Text:='120';if(l='S2')and (combobox1.Text='1200')then edit1.Text:='150';if(l='S2')and (combobox1.Text='2200')then edit1.Text:='300';

if(l='r1')and (combobox1.Text='450')then edit1.Text:='120';if(l='r1')and (combobox1.Text='900')then edit1.Text:='200';if(l='r1')and (combobox1.Text='1200')then edit1.Text:='300';

if(l='r2')and (combobox1.Text='900')then edit1.Text:='150';if(l='r2')and (combobox1.Text='1200')then edit1.Text:='300';if(l='r2')and (combobox1.Text='2200')then edit1.Text:='350';

Page 27: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

if(l='b1')and (combobox1.Text='2200')then edit1.Text:='400';if(l='b1')and (combobox1.Text='3300')then edit1.Text:='500';if(l='b1')and (combobox1.Text='5000')then edit1.Text:='600';

if(l='b2')and (combobox1.Text='3300')then edit1.Text:='500';if(l='b2')and (combobox1.Text='5000')then edit1.Text:='600';if(l='b1')and (combobox1.Text='10000')then edit1.Text:='700';end;

procedure TForm1.Edit3Change(Sender: TObject);beginif(edit3.text='') or (edit4.Text='') thenbegin edit3.Text:='0'; edit4.Text:='0';endelseedit4.Text:=inttostr(strtoint(edit3.Text)-strtoint(edit2.Text))end;

procedure TForm1.CheckBox1Click(Sender: TObject);beginif checkbox1.Checked=true then begin edit5.enabled:=true; edit5.Text:='15000'; activecontrol:=edit5; end else

begin edit5.Text:='0'; edit5.enabled:=false; end;end;procedure TForm1.Button1Click(Sender: TObject);vartarip,jum,pmi,denda,biaya,total:real;begin tarip:=strtoint(edit1.Text); jum:=strtoint(edit4.Text); pmi:=strtoint(edit5.Text); denda:=strtoint(edit6.Text); if (jum/tarip<=1) then biaya:=jum*tarip else

Page 28: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

if (jum/tarip>1)and (jum/tarip<=1.5) then biaya:=1.5*jum*tarip else if (jum/tarip>1.5) then biaya:=2*jum*tarip; total:=biaya+pmi+denda; edit7.Text:=floattostr(biaya); edit8.Text:=floattostr(total);end;

procedure TForm1.Button2Click(Sender: TObject);beginedit2.Text:='0';edit3.Text:='0';edit4.Text:='0';edit5.Text:='0';edit5.enabled:=false;edit6.Text:='0';edit6.Enabled:=false;checkbox1.checked:=false;checkbox2.Checked:=false;edit7.Text:='0';edit8.Text:='0';activecontrol:=edit2;end;

procedure TForm1.Button3Click(Sender: TObject);beginclose;end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);beginapplication.Terminate;end;

procedure TForm1.CheckBox2Click(Sender: TObject);beginif checkbox2.Checked=true then begin edit6.enabled:=true; edit6.Text:='35000'; activecontrol:=edit6; end else

Page 29: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

begin edit6.Text:='0'; edit6.enabled:=false; end;end;end.

procedure TForm1.GroupBox1Click(Sender: TObject);begin

end;end.end.

Latihan 9

Page 30: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

Object name caption EventsLabel1 Label1 Label1Label2 Label2 Label2Label3 Label3 Label3Label4 Label4 Label4Label5 Label5 Label5Label6 Label6 Label6Label7 Label7 Label7Label8 Label8 Label8Label9 Label9 Label9Label1 Label1 Label1Label10 Label10 Label10Label11 Label11 Label11Label12 Label12 Label12Label13 Label13 Label13Label14 Label14 Label14Label15 Label15 Label15Label16 Label16 Label16Label17 Label17 Label17Label18 Label18 Label18ComboBox1 ComboBox1ComboBox2 ComboBox2ComboBox3 ComboBox3ComboBox4 ComboBox4Button1 Button1 Button1Button2 Button2 Button2Button3 Button3 Button3Edit1 Edit1Edit2 Edit2

procedure TForm1.FormCreate(Sender: TObject);beginlabel1.Caption:=datetimetostr(now);label1.Font.Size:=10;label1.Font.Color:=clblue;label2.Caption:='KA FREE TRAIN';Label2.Font.size:=20;Label2.Font.Color:=clred;label3.Caption:='JUMLAH TIKET';label4.Caption:='TOTAL BAYAR';label5.Caption:='JENIS KERETA';label6.Caption:='JENIS PENUMPANG';label7.Caption:='KOTA TUJUAN';label8.Caption:='JAM PEMBERANGKATAN';

Page 31: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

label9.Caption:='PAGI';label10.Caption:='05.00';label11.Caption:='07.00';label12.Caption:='08.30';label13.Caption:='SORE';label14.Caption:='15.00';label15.caption:='17.00';label16.Caption:='MALAM';label17.Caption:='19.00';label18.Caption:='21.00';Button1.Caption:='HITUNG';button2.Caption:='BARU';button3.Caption:='CLOSE';groupbox1.Caption:='JADWAL KEBERANGKATAN';form1.Position:=podesktopcenter;edit1.maxlength:=1;end;

procedure TForm1.Button1Click(Sender: TObject);//==========================beginif combobox1.itemindex=0 thenif combobox2.itemindex=0 thenif combobox3.itemindex=0 thenif combobox4.itemindex=0 thenif edit1.text='1'thenedit2.Text:='20.000'elseif combobox1.itemindex=0 thenif combobox2.itemindex=0 thenif combobox3.itemindex=0 thenif combobox4.itemindex=0 thenif edit1.text='2'thenedit2.Text:='40.000'elseif combobox1.itemindex=0 thenif combobox2.itemindex=0 thenif combobox3.itemindex=0 thenif combobox4.itemindex=0 thenif edit1.text='3' thenedit2.Text:='60.000';

//==============================begin

Page 32: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

if combobox1.itemindex=0 thenif combobox2.itemindex=0 thenif combobox3.itemindex=0 thenif combobox4.itemindex=1 thenif edit1.text='1'thenedit2.Text:='15.000'elseif combobox1.itemindex=0 thenif combobox2.itemindex=0 thenif combobox3.itemindex=0 thenif combobox4.itemindex=1 thenif edit1.text='2'thenedit2.Text:='30.000'elseif combobox1.itemindex=0 thenif combobox2.itemindex=0 thenif combobox3.itemindex=0 thenif combobox4.itemindex=1 thenif edit1.text='3' thenedit2.Text:='45.000';end;

//==============================beginif combobox1.itemindex=0 thenif combobox2.itemindex=0 thenif combobox3.itemindex=0 thenif combobox4.itemindex=2 thenif edit1.text='1'thenedit2.Text:='10.000'elseif combobox1.itemindex=0 thenif combobox2.itemindex=0 thenif combobox3.itemindex=0 thenif combobox4.itemindex=2 thenif edit1.text='2'thenedit2.Text:='20.000'elseif combobox1.itemindex=0 thenif combobox2.itemindex=0 thenif combobox3.itemindex=0 thenif combobox4.itemindex=2 thenif edit1.text='3' thenedit2.Text:='30.000';

Page 33: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

end;

//============================ begin if combobox1.itemindex=0 then if combobox2.itemindex=1 then if combobox3.itemindex=0 then if combobox4.itemindex=0 then if edit1.text='1' then edit2.Text:='50.000' else if combobox1.itemindex=0 then if combobox2.itemindex=1 then if combobox3.itemindex=0 then if combobox4.itemindex=0 then if edit1.text='2'then edit2.Text:='100.000' else if combobox1.itemindex=0 then if combobox2.itemindex=1 then if combobox3.itemindex=0 then if combobox4.itemindex=0 then if edit1.text='3'then edit2.Text:='150.000';

//============================ begin if combobox1.itemindex=0 then if combobox2.itemindex=1 then if combobox3.itemindex=0 then if combobox4.itemindex=1 then if edit1.text='1' then edit2.Text:='30.000' else if combobox1.itemindex=0 then if combobox2.itemindex=1 then if combobox3.itemindex=0 then if combobox4.itemindex=1 then if edit1.text='2'then edit2.Text:='60.000' else if combobox1.itemindex=0 then if combobox2.itemindex=1 then if combobox3.itemindex=0 then

Page 34: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

if combobox4.itemindex=1 then if edit1.text='3'then edit2.Text:='90.000';

//=================================== begin if combobox1.itemindex=0 then if combobox2.itemindex=1 then if combobox3.itemindex=0 then if combobox4.itemindex=2 then if edit1.text='1' then edit2.Text:='20.000' else if combobox1.itemindex=0 then if combobox2.itemindex=1 then if combobox3.itemindex=0 then if combobox4.itemindex=2 then if edit1.text='2'then edit2.Text:='40.000' else if combobox1.itemindex=0 then if combobox2.itemindex=1 then if combobox3.itemindex=0 then if combobox4.itemindex=2 then if edit1.text='3'then edit2.Text:='60.000'; end;

//=================================== begin if combobox1.itemindex=0 then if combobox2.itemindex=2 then if combobox3.itemindex=0 then if combobox4.itemindex=0 then if edit1.text='1' then edit2.Text:='60.000' else if combobox1.itemindex=0 then if combobox2.itemindex=2 then if combobox3.itemindex=0 then if combobox4.itemindex=0 then if edit1.text='2'then edit2.Text:='120.000' else

Page 35: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

if combobox1.itemindex=0 then if combobox2.itemindex=2 then if combobox3.itemindex=0 then if combobox4.itemindex=0 then if edit1.text='3'then edit2.Text:='180.000';

//=================================== begin if combobox1.itemindex=0 then if combobox2.itemindex=2 then if combobox3.itemindex=0 then if combobox4.itemindex=1 then if edit1.text='1' then edit2.Text:='40.000' else if combobox1.itemindex=0 then if combobox2.itemindex=2 then if combobox3.itemindex=0 then if combobox4.itemindex=1 then if edit1.text='2'then edit2.Text:='80.000' else if combobox1.itemindex=0 then if combobox2.itemindex=2 then if combobox3.itemindex=0 then if combobox4.itemindex=1 then if edit1.text='3'then edit2.Text:='120.000'; end;

begin //=================================== if combobox1.itemindex=0 then if combobox2.itemindex=2 then if combobox3.itemindex=0 then if combobox4.itemindex=2 then if edit1.text='1' then edit2.Text:='30.000' else if combobox1.itemindex=0 then if combobox2.itemindex=2 then if combobox3.itemindex=0 then if combobox4.itemindex=2 then

Page 36: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

if edit1.text='2'then edit2.Text:='60.000' else if combobox1.itemindex=0 then if combobox2.itemindex=2 then if combobox3.itemindex=0 then if combobox4.itemindex=2 then if edit1.text='3'then edit2.Text:='90.000'; end;

begin //=================================== if combobox1.itemindex=1 then if combobox2.itemindex=0 then if combobox3.itemindex=0 then if combobox4.itemindex=0 then if edit1.text='1' then edit2.Text:='50.000' else if combobox1.itemindex=1 then if combobox2.itemindex=0 then if combobox3.itemindex=0 then if combobox4.itemindex=0 then if edit1.text='2'then edit2.Text:='100.000' else if combobox1.itemindex=1 then if combobox2.itemindex=0 then if combobox3.itemindex=0 then if combobox4.itemindex=0 then if edit1.text='3'then edit2.Text:='150.000';

begin //=================================== if combobox1.itemindex=1 then if combobox2.itemindex=0 then if combobox3.itemindex=0 then if combobox4.itemindex=1 then if edit1.text='1' then edit2.Text:='40.000' else

Page 37: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

if combobox1.itemindex=1 then if combobox2.itemindex=0 then if combobox3.itemindex=0 then if combobox4.itemindex=1 then if edit1.text='2'then edit2.Text:='80.000' else if combobox1.itemindex=1 then if combobox2.itemindex=0 then if combobox3.itemindex=0 then if combobox4.itemindex=1 then if edit1.text='3'then edit2.Text:='120.000'; end;

begin //=================================== if combobox1.itemindex=1 then if combobox2.itemindex=0 then if combobox3.itemindex=0 then if combobox4.itemindex=2 then if edit1.text='1' then edit2.Text:='30.000' else if combobox1.itemindex=1 then if combobox2.itemindex=0 then if combobox3.itemindex=0 then if combobox4.itemindex=2 then if edit1.text='2'then edit2.Text:='60.000' else if combobox1.itemindex=1 then if combobox2.itemindex=0 then if combobox3.itemindex=0 then if combobox4.itemindex=2 then if edit1.text='3'then edit2.Text:='90.000'; end;

begin //=================================== if combobox1.itemindex=1 then if combobox2.itemindex=1 then if combobox3.itemindex=0 then

Page 38: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

if combobox4.itemindex=0 then if edit1.text='1' then edit2.Text:='80.000' else if combobox1.itemindex=1 then if combobox2.itemindex=1 then if combobox3.itemindex=0 then if combobox4.itemindex=0 then if edit1.text='2'then edit2.Text:='160.000' else if combobox1.itemindex=1 then if combobox2.itemindex=1 then if combobox3.itemindex=0 then if combobox4.itemindex=0 then if edit1.text='3'then edit2.Text:='240.000';

begin //=================================== if combobox1.itemindex=1 then if combobox2.itemindex=1 then if combobox3.itemindex=0 then if combobox4.itemindex=1 then if edit1.text='1' then edit2.Text:='60.000' else if combobox1.itemindex=1 then if combobox2.itemindex=1 then if combobox3.itemindex=0 then if combobox4.itemindex=1 then if edit1.text='2'then edit2.Text:='120.000' else if combobox1.itemindex=1 then if combobox2.itemindex=1 then if combobox3.itemindex=0 then if combobox4.itemindex=1 then if edit1.text='3'then edit2.Text:='180.000';

begin //=================================== if combobox1.itemindex=1 then

Page 39: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

if combobox2.itemindex=1 then if combobox3.itemindex=0 then if combobox4.itemindex=2 then if edit1.text='1' then edit2.Text:='50.000' else if combobox1.itemindex=1 then if combobox2.itemindex=1 then if combobox3.itemindex=0 then if combobox4.itemindex=2 then if edit1.text='2'then edit2.Text:='100.000' else if combobox1.itemindex=1 then if combobox2.itemindex=1 then if combobox3.itemindex=0 then if combobox4.itemindex=2 then if edit1.text='3'then edit2.Text:='150.000'; end;

begin //=================================== if combobox1.itemindex=1 then if combobox2.itemindex=2 then if combobox3.itemindex=0 then if combobox4.itemindex=0 then if edit1.text='1' then edit2.Text:='90.000' else if combobox1.itemindex=1 then if combobox2.itemindex=2 then if combobox3.itemindex=0 then if combobox4.itemindex=0 then if edit1.text='2'then edit2.Text:='180.000' else if combobox1.itemindex=1 then if combobox2.itemindex=2 then if combobox3.itemindex=0 then if combobox4.itemindex=0 then if edit1.text='3'then edit2.Text:='270.000'; end;

Page 40: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

begin //=================================== if combobox1.itemindex=1 then if combobox2.itemindex=2 then if combobox3.itemindex=0 then if combobox4.itemindex=1 then if edit1.text='1' then edit2.Text:='80.000' else if combobox1.itemindex=1 then if combobox2.itemindex=2 then if combobox3.itemindex=0 then if combobox4.itemindex=1 then if edit1.text='2'then edit2.Text:='160.000' else if combobox1.itemindex=1 then if combobox2.itemindex=2 then if combobox3.itemindex=0 then if combobox4.itemindex=1 then if edit1.text='3'then edit2.Text:='240.000'; end; begin //vip->orang tua->jakarta->malam if combobox1.itemindex=1 then if combobox2.itemindex=2 then if combobox3.itemindex=0 then if combobox4.itemindex=2 then if edit1.text='1' then edit2.Text:='70.000' else if combobox1.itemindex=1 then if combobox2.itemindex=2 then if combobox3.itemindex=0 then if combobox4.itemindex=2 then if edit1.text='2'then edit2.Text:='140.000' else if combobox1.itemindex=1 then if combobox2.itemindex=2 then if combobox3.itemindex=0 then if combobox4.itemindex=2 then if edit1.text='3'then

Page 41: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

edit2.Text:='210.000'; end;

begin//===================================if combobox1.itemindex=0 thenif combobox2.itemindex=0 thenif combobox3.itemindex=1 thenif combobox4.itemindex=0 thenif edit1.text='1'thenedit2.Text:='15.000'elseif combobox1.itemindex=0 thenif combobox2.itemindex=0 thenif combobox3.itemindex=1 thenif combobox4.itemindex=0 thenif edit1.text='2'thenedit2.Text:='30.000'elseif combobox1.itemindex=0 thenif combobox2.itemindex=0 thenif combobox3.itemindex=1 thenif combobox4.itemindex=0 thenif edit1.text='3' thenedit2.Text:='45.000';end;

begin//===================================if combobox1.itemindex=0 thenif combobox2.itemindex=0 thenif combobox3.itemindex=1 thenif combobox4.itemindex=1 thenif edit1.text='1'thenedit2.Text:='10.000'elseif combobox1.itemindex=0 thenif combobox2.itemindex=0 thenif combobox3.itemindex=1 thenif combobox4.itemindex=1 thenif edit1.text='2'thenedit2.Text:='20.000'else

Page 42: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

if combobox1.itemindex=0 thenif combobox2.itemindex=0 thenif combobox3.itemindex=1 thenif combobox4.itemindex=1 thenif edit1.text='3' thenedit2.Text:='30.000';end;

begin//===================================if combobox1.itemindex=0 thenif combobox2.itemindex=0 thenif combobox3.itemindex=1 thenif combobox4.itemindex=2 thenif edit1.text='1'thenedit2.Text:='5.000'elseif combobox1.itemindex=0 thenif combobox2.itemindex=0 thenif combobox3.itemindex=1 thenif combobox4.itemindex=2 thenif edit1.text='2'thenedit2.Text:='10.000'elseif combobox1.itemindex=0 thenif combobox2.itemindex=0 thenif combobox3.itemindex=1 thenif combobox4.itemindex=2 thenif edit1.text='3' thenedit2.Text:='15.000';end;

begin//=================================== if combobox1.itemindex=0 then if combobox2.itemindex=1 then if combobox3.itemindex=1 then if combobox4.itemindex=0 then if edit1.text='1' then edit2.Text:='20.000' else if combobox1.itemindex=0 then if combobox2.itemindex=1 then if combobox3.itemindex=1 then

Page 43: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

if combobox4.itemindex=0 then if edit1.text='2'then edit2.Text:='40.000' else if combobox1.itemindex=0 then if combobox2.itemindex=1 then if combobox3.itemindex=1 then if combobox4.itemindex=0 then if edit1.text='3'then edit2.Text:='60.000'; end;

begin//=================================== if combobox1.itemindex=0 then if combobox2.itemindex=1 then if combobox3.itemindex=1 then if combobox4.itemindex=1 then if edit1.text='1' then edit2.Text:='25.000' else if combobox1.itemindex=0 then if combobox2.itemindex=1 then if combobox3.itemindex=1 then if combobox4.itemindex=1 then if edit1.text='2'then edit2.Text:='50.000' else if combobox1.itemindex=0 then if combobox2.itemindex=1 then if combobox3.itemindex=1 then if combobox4.itemindex=1 then if edit1.text='3'then edit2.Text:='75.000'; end;

begin//=================================== if combobox1.itemindex=0 then if combobox2.itemindex=1 then if combobox3.itemindex=1 then if combobox4.itemindex=2 then if edit1.text='1' then edit2.Text:='30.000'

Page 44: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

else if combobox1.itemindex=0 then if combobox2.itemindex=1 then if combobox3.itemindex=1 then if combobox4.itemindex=2 then if edit1.text='2'then edit2.Text:='60.000' else if combobox1.itemindex=0 then if combobox2.itemindex=1 then if combobox3.itemindex=1 then if combobox4.itemindex=2 then if edit1.text='3'then edit2.Text:='90.000'; end;

begin //=================================== if combobox1.itemindex=0 then if combobox2.itemindex=2 then if combobox3.itemindex=1 then if combobox4.itemindex=0 then if edit1.text='1' then edit2.Text:='35.000' else if combobox1.itemindex=0 then if combobox2.itemindex=2 then if combobox3.itemindex=1 then if combobox4.itemindex=0 then if edit1.text='2'then edit2.Text:='70.000' else if combobox1.itemindex=0 then if combobox2.itemindex=2 then if combobox3.itemindex=1 then if combobox4.itemindex=0 then if edit1.text='3'then edit2.Text:='105.000'; end;

begin //=================================== if combobox1.itemindex=0 then if combobox2.itemindex=2 then

Page 45: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

if combobox3.itemindex=1 then if combobox4.itemindex=1 then if edit1.text='1' then edit2.Text:='40.000' else if combobox1.itemindex=0 then if combobox2.itemindex=2 then if combobox3.itemindex=1 then if combobox4.itemindex=1 then if edit1.text='2'then edit2.Text:='80.000' else if combobox1.itemindex=0 then if combobox2.itemindex=2 then if combobox3.itemindex=1 then if combobox4.itemindex=1 then if edit1.text='3'then edit2.Text:='120.000'; end;

begin //=================================== if combobox1.itemindex=0 then if combobox2.itemindex=2 then if combobox3.itemindex=1 then if combobox4.itemindex=2 then if edit1.text='1' then edit2.Text:='50.000' else if combobox1.itemindex=0 then if combobox2.itemindex=2 then if combobox3.itemindex=1 then if combobox4.itemindex=2 then if edit1.text='2'then edit2.Text:='100.000' else if combobox1.itemindex=0 then if combobox2.itemindex=2 then if combobox3.itemindex=1 then if combobox4.itemindex=2 then if edit1.text='3'then edit2.Text:='150.000'; end;

Page 46: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

begin //=================================== if combobox1.itemindex=1 then if combobox2.itemindex=0 then if combobox3.itemindex=1 then if combobox4.itemindex=0 then if edit1.text='1' then edit2.Text:='20.000' else if combobox1.itemindex=1 then if combobox2.itemindex=0 then if combobox3.itemindex=1 then if combobox4.itemindex=0 then if edit1.text='2'then edit2.Text:='40.000' else if combobox1.itemindex=1 then if combobox2.itemindex=0 then if combobox3.itemindex=1 then if combobox4.itemindex=0 then if edit1.text='3'then edit2.Text:='60.000'; end;

begin //=================================== if combobox1.itemindex=1 then if combobox2.itemindex=0 then if combobox3.itemindex=1 then if combobox4.itemindex=1 then if edit1.text='1' then edit2.Text:='15.000' else if combobox1.itemindex=1 then if combobox2.itemindex=0 then if combobox3.itemindex=1 then if combobox4.itemindex=1 then if edit1.text='2'then edit2.Text:='30.000' else if combobox1.itemindex=1 then if combobox2.itemindex=0 then if combobox3.itemindex=1 then

Page 47: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

if combobox4.itemindex=1 then if edit1.text='3'then edit2.Text:='45.000'; end;

begin //=================================== if combobox1.itemindex=1 then if combobox2.itemindex=0 then if combobox3.itemindex=1 then if combobox4.itemindex=2 then if edit1.text='1' then edit2.Text:='10.000' else if combobox1.itemindex=1 then if combobox2.itemindex=0 then if combobox3.itemindex=1 then if combobox4.itemindex=2 then if edit1.text='2'then edit2.Text:='20.000' else if combobox1.itemindex=1 then if combobox2.itemindex=0 then if combobox3.itemindex=1 then if combobox4.itemindex=2 then if edit1.text='3'then edit2.Text:='30.000'; end;

begin //=================================== if combobox1.itemindex=1 then if combobox2.itemindex=1 then if combobox3.itemindex=1 then if combobox4.itemindex=0 then if edit1.text='1' then edit2.Text:='40.000' else if combobox1.itemindex=1 then if combobox2.itemindex=1 then if combobox3.itemindex=1 then if combobox4.itemindex=0 then if edit1.text='2'then edit2.Text:='80.000'

Page 48: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

else if combobox1.itemindex=1 then if combobox2.itemindex=1 then if combobox3.itemindex=1 then if combobox4.itemindex=0 then if edit1.text='3'then edit2.Text:='120.000'; end;

begin //=================================== if combobox1.itemindex=1 then if combobox2.itemindex=1 then if combobox3.itemindex=1 then if combobox4.itemindex=1 then if edit1.text='1' then edit2.Text:='35.000' else if combobox1.itemindex=1 then if combobox2.itemindex=1 then if combobox3.itemindex=1 then if combobox4.itemindex=1 then if edit1.text='2'then edit2.Text:='70.000' else if combobox1.itemindex=1 then if combobox2.itemindex=1 then if combobox3.itemindex=1 then if combobox4.itemindex=1 then if edit1.text='3'then edit2.Text:='105.000'; end;

begin //=================================== if combobox1.itemindex=1 then if combobox2.itemindex=1 then if combobox3.itemindex=1 then if combobox4.itemindex=2 then if edit1.text='1' then edit2.Text:='25.000' else if combobox1.itemindex=1 then if combobox2.itemindex=1 then

Page 49: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

if combobox3.itemindex=1 then if combobox4.itemindex=2 then if edit1.text='2'then edit2.Text:='50.000' else if combobox1.itemindex=1 then if combobox2.itemindex=1 then if combobox3.itemindex=1 then if combobox4.itemindex=2 then if edit1.text='3'then edit2.Text:='75.000'; end;

begin //=================================== if combobox1.itemindex=1 then if combobox2.itemindex=2 then if combobox3.itemindex=1 then if combobox4.itemindex=0 then if edit1.text='1' then edit2.Text:='50.000' else if combobox1.itemindex=1 then if combobox2.itemindex=2 then if combobox3.itemindex=1 then if combobox4.itemindex=0 then if edit1.text='2'then edit2.Text:='100.000' else if combobox1.itemindex=1 then if combobox2.itemindex=2 then if combobox3.itemindex=1 then if combobox4.itemindex=0 then if edit1.text='3'then edit2.Text:='150.000'; end;

begin //=================================== if combobox1.itemindex=1 then if combobox2.itemindex=2 then if combobox3.itemindex=1 then if combobox4.itemindex=1 then if edit1.text='1' then

Page 50: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

edit2.Text:='40.000' else if combobox1.itemindex=1 then if combobox2.itemindex=2 then if combobox3.itemindex=1 then if combobox4.itemindex=1 then if edit1.text='2'then edit2.Text:='80.000' else if combobox1.itemindex=1 then if combobox2.itemindex=2 then if combobox3.itemindex=1 then if combobox4.itemindex=1 then if edit1.text='3'then edit2.Text:='120.000'; end;

begin //=================================== if combobox1.itemindex=1 then if combobox2.itemindex=2 then if combobox3.itemindex=1 then if combobox4.itemindex=2 then if edit1.text='1' then edit2.Text:='30.000' else if combobox1.itemindex=1 then if combobox2.itemindex=2 then if combobox3.itemindex=1 then if combobox4.itemindex=2 then if edit1.text='2'then edit2.Text:='60.000' else if combobox1.itemindex=1 then if combobox2.itemindex=2 then if combobox3.itemindex=1 then if combobox4.itemindex=2 then if edit1.text='3'then edit2.Text:='90.000'; end;

end; end;

Page 51: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

end; end; end;end;end;

procedure TForm1.Button3Click(Sender: TObject);beginclose;end;

procedure TForm1.Button2Click(Sender: TObject);begincombobox1.text:='';combobox2.text:='';combobox3.text:='';combobox4.text:='';edit1.Text:='';edit2.Text:='';end;

latihan 10

Object name caption EventsDateTimePicker1 timeButton1 btnkeuangan Keuangan onclic (btnkeuangan)Button2 btnkesehatan kesehatan Onclic(btnkesehatan)Bitbutton1 Bitbutton1 Kind(bkclose)Memo1 Memo1

Page 52: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

var indeks,kodehari:integer; tahun,bulan,tanggal:word;

procedure TForm1.OnChange(Sender: TObject);const bintang : array[1..12]of record nama : string[10]; tgl1,bln1,tgl2,bln2:integer end =((nama:'aries';tgl1:21;bln1:3;tgl2:19;bln2:4), (nama:'taurus';tgl1:20;bln1:4;tgl2:20;bln2:5), (nama:'gemini';tgl1:21;bln1:5;tgl2:19;bln2:6), (nama:'cancer';tgl1:21;bln1:6;tgl2:19;bln2:7), (nama:'leo';tgl1:21;bln1:7;tgl2:19;bln2:8), (nama:'virgo';tgl1:20;bln1:8;tgl2:19;bln2:9), (nama:'libra';tgl1:21;bln1:9;tgl2:19;bln2:10), (nama:'scorpio';tgl1:21;bln1:10;tgl2:19;bln2:11), (nama:'sagitarius';tgl1:21;bln1:11;tgl2:19;bln2:12), (nama:'capricon';tgl1:21;bln1:12;tgl2:19;bln2:1), (nama:'aquarius';tgl1:21;bln1:1;tgl2:19;bln2:2), (nama:'piscess';tgl1:21;bln1:2;tgl2:19;bln2:3));

begin kodehari:=dayofweek(time.Date); case kodehari of 1:hari.Caption:='minggu'; 2:hari.Caption:='senin'; 3:hari.Caption:='selasa'; 4:hari.Caption:='rabu'; 5:hari.Caption:='kamis'; 6:hari.Caption:='jumat'; 7:hari.Caption:='sabtu';end;decodedate(time.date,tahun,bulan,tanggal);for indeks:=1 to 12 doIf ((tanggal>=bintang[indeks].tgl1) and (bulan=bintang[indeks].bln1)) or ((tanggal<=bintang[indeks].tgl2) and (bulan=bintang[indeks].bln2)) then

begin zodiak.Caption:='zodiak :'+bintang[indeks].nama; break;

Page 53: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

end; end; procedure TForm1.BitBtn1Click(Sender: TObject);beginCloseend;

procedure TForm1.btnkeuanganClick(Sender: TObject);begin kodehari:=dayofweek(time.Date); case kodehari of 1:Memo1.Text:='Kaya'; 2:Memo1.Text:='miskin'; 3:Memo1.Text:='cair'; 4:Memo1.Text:='terima uang'; 5:Memo1.Text:='lagi mines'; 6:Memo1.Text:='harus berhemat'; 7:Memo1.Text:='silahkan berpoya-poya';end;end;

procedure TForm1.btnkesehatanClick(Sender: TObject);beginIf zodiak.Caption='zodiak :aries' thenmemo1.Text:='Kamu sedang harus berolahraga';If zodiak.Caption='zodiak :taurus' thenmemo1.Text:='Sedikit terkena Flu';If zodiak.Caption='zodiak :gemini' thenmemo1.Text:='Sakit kepala berlebihan';If zodiak.Caption='zodiak :cancer' thenmemo1.Text:='Kurangi makan pedas dan berlemak';If zodiak.Caption='zodiak :leo' thenmemo1.Text:='Cobalah untuk berenang';If zodiak.Caption='zodiak :virgo' thenmemo1.Text:='Minumlah suplemen makansan dan vitamin';If zodiak.Caption='zodiak :libra' thenmemo1.Text:='Kamu sedang sehat';If zodiak.Caption='zodiak :scorpio' thenmemo1.Text:='Kondisi badan kamu lagi prima banget';If zodiak.Caption='zodiak :sagitarius' thenmemo1.Text:='Badan kamu bakal sakit dan lelah beberapa minggu kedepan';If zodiak.Caption='zodiak :capricorn' thenmemo1.Text:='Perbanyak makan protein dan sayur-sayuran';If zodiak.Caption='zodiak :aquarius' then

Page 54: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

memo1.Text:='Enggak lagi kamu bakal meninggal';If zodiak.Caption='zodiak :picess' thenmemo1.Text:='Kondisi Kamu perfect ... Luar biasa';end;end.

TAIHAN 11

FORM 1

Object name Caption EventsCheckBox1 CheckBox1 NASI GORENGCheckBox2 CheckBox2 MIE GORENGCheckBox3 CheckBox3 CAMPURCheckBox4 CheckBox4 TEHCheckBox5 CheckBox5 KOPICheckBox6 CheckBox6 SUSUCheckBox7 CheckBox7 AIR MINERALCheckBox8 CheckBox8 TELORCheckBox9 CheckBox9 AYAM

Page 55: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

Edit1 Edit1 Edit1Edit2 Edit2 Edit2Edit3 Edit3 Edit3Edit4 Edit4 Edit4Edit5 Edit5 Edit5Edit6 Edit6 Edit6Edit7 Edit7 Edit7Edit8 Edit8 Edit8Edit9 Edit9 Edit9edit10 edit10 edit10edit12 edit12 edit12edit13 edit13 edit13edit14 edit14 edit14edit15 edit15 edit15edit16 edit16 edit16edit17 edit17 edit17edit18 edit18 edit18edit19 edit19 edit19Edit20 Edit20 Edit20Edit21 Edit21 Edit21Edit22 Edit22 Edit22Edit23 Edit23 Edit23Edit24 Edit24 Edit24Edit25 Edit25 Edit25Edit26 Edit26 Edit26Edit27 Edit27 Edit27Label1 Label1 Label1Label2 Label2 Label2Label3 Label3 Label3Label4 Label4 Label4Panel1 Panel1 Total bayarButton1 Button1 hitungButton2 Button2 HapusButton3 Button3 keluar

procedure TForm1.CheckBox1Click(Sender: TObject);beginif checkbox1.checked=true then begin edit1.text:='10000'; edit10.setfocus; end else if checkbox1.checked=false then begin edit10.Text:='0';

Page 56: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

edit10.setfocus; end;

end;

procedure TForm1.CheckBox2Click(Sender: TObject);beginif checkbox2.checked=true then begin edit2.text:='15000'; edit11.setfocus; end else if checkbox2.checked=false then begin edit11.Text:='0'; edit11.setfocus; end;end;

procedure TForm1.CheckBox3Click(Sender: TObject);beginif checkbox3.checked=true then begin edit3.text:='12000'; edit12.setfocus; end else if checkbox3.checked=false then begin edit12.Text:='0'; edit12.SetFocus; end;end;

procedure TForm1.FormCreate(Sender: TObject);beginedit1.Text:='0';edit2.Text:='0';edit3.Text:='0';edit4.Text:='0';edit5.Text:='0';edit6.Text:='0';edit7.Text:='0';

Page 57: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

edit8.Text:='0';edit9.Text:='0';edit10.Text:='0';edit11.Text:='0';edit12.Text:='0';edit13.Text:='0';edit14.Text:='0';edit15.Text:='0';edit16.Text:='0';edit17.Text:='0';edit18.Text:='0';edit19.Text:='0';edit20.Text:='0';edit21.Text:='0';edit22.Text:='0';edit23.Text:='0';edit24.Text:='0';edit25.Text:='0';edit26.Text:='0';edit27.Text:='0';end;

procedure TForm1.CheckBox4Click(Sender: TObject);beginif checkbox4.checked=true then begin edit4.text:='2000'; edit13.setfocus; end else if checkbox4.checked=false then begin edit13.Text:='0'; edit13.setfocus; end;end;

procedure TForm1.CheckBox5Click(Sender: TObject);beginif checkbox5.checked=true then begin edit5.text:='4000'; edit14.setfocus; end

Page 58: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

else if checkbox5.checked=false then begin edit14.Text:='0'; edit14.setfocus; end;end;

procedure TForm1.CheckBox6Click(Sender: TObject);beginif checkbox6.checked=true then begin edit6.text:='5000'; edit15.setfocus; end else if checkbox6.checked=false then begin edit15.Text:='0'; edit15.setfocus; end;end;

procedure TForm1.CheckBox7Click(Sender: TObject);beginif checkbox7.checked=true then begin edit7.text:='2000'; edit16.setfocus; end else if checkbox7.checked=false then begin edit16.Text:='0'; edit16.setfocus; end;end;

procedure TForm1.CheckBox8Click(Sender: TObject);beginif checkbox8.checked=true then begin edit8.text:='2000'; edit17.setfocus;

Page 59: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

end else if checkbox8.checked=false then begin edit17.Text:='0'; edit17.setfocus; end;end;

procedure TForm1.CheckBox9Click(Sender: TObject);beginif checkbox9.checked=true then begin edit9.text:='2000'; edit18.setfocus; end else if checkbox9.checked=false then begin edit18.Text:='0'; edit18.setfocus; end;end;

procedure TForm1.Edit10Change(Sender: TObject);varharga, jumlah, biaya: real;beginharga:=strtofloat(Edit1.Text);jumlah:=strtofloat(Edit10.Text);biaya:=harga*jumlah;Edit19.Text :=floattostr(biaya);end;

procedure TForm1.Edit11Change(Sender: TObject);varharga, jumlah, biaya: real;beginharga:=strtofloat(Edit2.Text);jumlah:=strtofloat(Edit11.Text);biaya:=harga*jumlah;Edit20.Text :=floattostr(biaya);end;

Page 60: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

procedure TForm1.Edit12Change(Sender: TObject);varharga, jumlah, biaya: real;beginharga:=strtofloat(Edit3.Text);jumlah:=strtofloat(Edit12.Text);biaya:=harga*jumlah;Edit21.Text :=floattostr(biaya);end;

procedure TForm1.Edit13Change(Sender: TObject);varharga, jumlah, biaya: real;beginharga:=strtofloat(Edit4.Text);jumlah:=strtofloat(Edit13.Text);biaya:=harga*jumlah;Edit22.Text :=floattostr(biaya);end;

procedure TForm1.Edit14Change(Sender: TObject);varharga, jumlah, biaya: real;beginharga:=strtofloat(Edit5.Text);jumlah:=strtofloat(Edit14.Text);biaya:=harga*jumlah;Edit23.Text :=floattostr(biaya);end;

procedure TForm1.Edit15Change(Sender: TObject);varharga, jumlah, biaya: real;beginharga:=strtofloat(Edit6.Text);jumlah:=strtofloat(Edit15.Text);biaya:=harga*jumlah;Edit24.Text :=floattostr(biaya);end;

procedure TForm1.Edit16Change(Sender: TObject);

Page 61: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

varharga, jumlah, biaya: real;beginharga:=strtofloat(Edit7.Text);jumlah:=strtofloat(Edit16.Text);biaya:=harga*jumlah;Edit25.Text :=floattostr(biaya);end;

procedure TForm1.Edit17Change(Sender: TObject);varharga, jumlah, biaya: real;beginharga:=strtofloat(Edit8.Text);jumlah:=strtofloat(Edit17.Text);biaya:=harga*jumlah;Edit26.Text :=floattostr(biaya);end;

procedure TForm1.Edit18Change(Sender: TObject);varharga, jumlah, biaya: real;beginharga:=strtofloat(Edit9.Text);jumlah:=strtofloat(Edit18.Text);biaya:=harga*jumlah;Edit27.Text :=floattostr(biaya);end;

procedure TForm1.Button1Click(Sender: TObject);vara,b,c,d,e,f,g,h,i,biaya,pajak1,pajak2: real;begina:=strtofloat(Edit19.Text);b:=strtofloat(Edit20.Text);c:=strtofloat(Edit21.Text);d:=strtofloat(Edit22.Text);e:=strtofloat(Edit23.Text);f:=strtofloat(Edit24.Text);g:=strtofloat(Edit25.Text);h:=strtofloat(Edit26.Text);

Page 62: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

i:=strtofloat(Edit27.Text);biaya:=a+b+c+d+e+f+g+h+i;label2.caption :=floattostr(biaya);pajak1:=biaya*10/100;label3.caption :=floattostr(pajak1);panel1.Caption:='TERIMA KASIH !';form2.label6.caption:=form1.label2.Caption;pajak2:=biaya+pajak1;form2.label7.caption:=floattostr(pajak2);form2.show;form2.edit1.Text:='0';form2.edit2.Text:='0';end;

procedure TForm1.Button3Click(Sender: TObject);beginclose;end;end.

FORM 2Object name Caption EventsLabel1 Label1 Label1Label2 Label2 Sebelum pajakLabel3 Label3 Sesudah pajakLabel4 Label4 bayarLabel5 Label5 kembaliLabel6 Label6 Label6Label7 Label7 Label7Edit1 Edit1 Edit1Edit2 Edit2 Edit2Button1 Button1 HitungButton1 Button1 Keluar

procedure TForm2.Button1Click(Sender: TObject);vara,b,c:real;begina:=strtofloat(label7.caption);b:=strtofloat(edit1.Text);c:=b-a;edit2.Text:=floattostr(c);if b<a then showmessage ('Maaf Jumlah Uang Yang Diberikan Kurang!');end;

Page 63: hermantosangpengembara.files.wordpress.com  · Web viewBagian dari delphi yang digunakan untuk menuliskan kode program. Pada bagian code editor terdapat 3 bagian utama yaitu =bagian

procedure TForm2.Button2Click(Sender: TObject);beginclose;end;

procedure TForm2.FormCreate(Sender: TObject);beginedit1.Text:='0';edit2.Text:='0';end;

end.