Pemrograman Terstruktur I

download Pemrograman Terstruktur I

of 59

  • date post

    05-Aug-2015
  • Category

    Documents

  • view

    209
  • download

    7

Embed Size (px)

Transcript of Pemrograman Terstruktur I

PEMROGRAMAN TERSTRUKTUR I

Agus Prihanto, MKom

DELPHI SIMULATIONS FMIPA-UNESA 2011

DAFTAR ISI

ContentsDAFTAR ISI ..................................................................................................................... i BAB 1. PENDAHULUAN .............................................................................................. 1 A. Apa itu Delphi ? ....................................................................................................... 1 B. IDE (Integrated Development Environtment) Delphi 7........................................... 1 a. Menu ..................................................................................................................... 1 b. Speed Bar.............................................................................................................. 1 c. Component Pallete ................................................................................................ 2 d. Form Designer ...................................................................................................... 2 e. Code Editor ........................................................................................................... 2 f. Object Inspector .................................................................................................... 2 g. Object Treeview ................................................................................................... 2 C. Format File ............................................................................................................... 3 D. Tombol Shortcut penting ......................................................................................... 3 BAB 2. PEMROGRAMAN BERORIENTASI OBJECT(OOP) .................................... 4 A. Perkembangan Bahasa Pemrograman...................................................................... 4 B. Apa itu Pemrograman Beriorentasi Object ? ........................................................... 4 C. Ciri-ciri Pemrograman Berorientasi Object ............................................................. 6 a. Pengkapsulan (Encapsulation) .............................................................................. 6 b. Pewarisan (Inheritance) ........................................................................................ 7 c. Multifungsi (Polymorphism) ................................................................................ 7 Contoh Delphi : Meletakkan komponen ....................................................................... 8 Contoh Delphi : Mengubah property object ................................................................. 9 BAB 3. TIPE DATA DAN OPERATOR...................................................................... 11 A. Komentar ............................................................................................................... 11 a. Komentar Blook .................................................................................................. 11 b. Komentar Baris ................................................................................................... 11 B. Variable .................................................................................................................. 11 a. Tipe Bilangan Bulat ............................................................................................ 11 b. Tipe Bilangan Pecahan ....................................................................................... 12 c. Tipe Boolean (Banar dan Salah) ......................................................................... 12 i

d. Tipe Karakter (char) .......................................................................................... 12 e. Tipe String (string) ............................................................................................. 12 C. Konstanta ............................................................................................................... 12 D. Array ...................................................................................................................... 12 E. Varian ..................................................................................................................... 12 F. Operator .................................................................................................................. 13 a. Operator Aritmetik .............................................................................................. 13 b. Operator Pembanding ......................................................................................... 13 Contoh Delphi : Membuat kalkulator sederhana ........................................................ 14 Contoh Delphi : Mencari Rumus Konversi Derajat ke Farentheit ............................. 15 BAB 4. ALIRAN PROGRAM DAN SUBRUTIN ....................................................... 17 A. Percabangan ........................................................................................................... 17 a. Pernyataan if .. else .. .......................................................................................... 17 b. Pernyataan if ... else if .. else .. ........................................................................... 17 c. Pernyataan Case .................................................................................................. 17 B. Pengulangan ........................................................................................................... 18 1. Pernyataan For .................................................................................................... 18 2. Pernyataan While................................................................................................ 18 3. Pernyataan Repeat .. Until .................................................................................. 18 4. Pernyataan break................................................................................................. 18 5. Pernyataan continue;........................................................................................... 18 C. Subrutin Procedure dan Fungsi .............................................................................. 18 1. Procedure ............................................................................................................ 18 2. Function .............................................................................................................. 19 Contoh Delphi : Konversi Nilai Angka ke huruf ........................................................ 19 Contoh Delphi : Generate data secara berurut ............................................................ 20 Contoh Delphi : Konversi Bilangan Decimal Ke Bilangan Romawi ......................... 21 Contoh Delphi : Konversi Nilai Uang Ke Kalimat Terbilang .................................... 23 Contoh Delphi : Bilangan Pascal ................................................................................ 25 Contoh Delphi : Bilangan Prima ................................................................................ 27 BAB 5. PENGENALAN KOMPONEN STANDART ................................................. 30 A. Mengenal komponen standard ............................................................................... 30 B. Latihan Penggunaan Komponen ............................................................................ 31 1. Formulir Biodata .................................................................................................... 31

ii

2. Membuat Menu ...................................................................................................... 34 3. Multi Form.............................................................................................................. 36 4. Konversi Suhu ........................................................................................................ 39 BAB 6. CHART DAN APLIKASINYA ........................................................................ 41 11. Menggambar graphics dengan komponen TChart................................................ 42 12. Simulasi Gerak Peluru .......................................................................................... 45 CANVAS .................................................................................................................... 49 System koordinat TCanvas ......................................................................................... 49 PENGGUNAAN KOMPONEN TCHART UNTUK MEMBUAT SIMULASI GRAPHICS ................................................................................................................ 51 A. Pengenalan ............................................................................................................. 51 B. Contoh Penggunaan Tchart untuk Membuat Program Simulasi Superposisi 2 Gelombang Dipandu Oleh Dosen ............................................................................... 51 Petunjuk ...................................................................................................................... 51 c. Praktek Membuat Program Simulasi Interpolasi 2 Gelombang Oleh Mahasiswa.. 55 Petunjuk :.................................................................................................................... 55

iii

BAB 1. PENDAHULUANA. Apa itu Delphi ? Ide munculnya Delphi sebenarnya berasal dari bahasa pemrograman yang cukup terkenal, yaitu Pascal. Bahasa Pascal sendiri telah diciptakan pada tahun 1971 oleh ilmuwan dari Swiss. Nama Pascal diambil dari ahli matematika dan fislsafat perancis, yaitu Blaise Pascal (1923-1662). Pada tahun 1992, Borland Internasional menggabungkan Turbo Pascal For Dos dan Turbo Pascal For Windows menjadi satu paket bahasa pemrograman yang dikenal dengan nama Borland Pascal Versi 7. Karena pemrograman Windows dengan Borland Pascal masih dirasa cukup sulit, sejak tahun 1993 Borland Intern