SlideShare a Scribd company logo
1 of 31
Download to read offline
Pertemuan 8
Pemrograman
Dokumentasi
• Flowchart:
– Lambang, simbol, gambar
– Arah panah
• Pseudo code
– Uraian sistematis dengan bahasa biasa
Program Control Structure
• Sequence structure
• Branch structure
• Loop structure
Sequence
• Instruksi dikerjakan secara berurutan.
– dari atas ke bawah
step Instruksi
1 Input jmlBrg, hrgSat
2 harga ← jmlBrg x hrgSat
3 Print harga
Contoh Sequence (1)
• Program akan dikerjakan dengan input:
– 2, 1500
step Variabel Output
jmlBrg hrgSat harga
step Instruksi
1 Input jmlBrg, hrgSat
2 harga ← jmlBrg x hrgSat
3 Print harga
Contoh Sequence (2)
• Mulai dengan langkah-1:
– Input 2, 1500
step Instruksi
1 Input jmlBrg, hrgSat
2 harga ← jmlBrg x hrgSat
3 Print harga
step Variabel Output
jmlBrg hrgSat harga
1 2 1500
Contoh Sequence (3)
• Langkah-2:
– Hitung perkalian, simpan
hasilnya di variabel harga
step Instruksi
1 Input jmlBrg, hrgSat
2 harga ← jmlBrg x hrgSat
3 Print harga
step Variabel Output
jmlBrg hrgSat harga
1 2 1500
2 2 1500 3000
Contoh Sequence (4)
• Langkah-3:
– Tampilkan isi
variabel harga
step Instruksi
1 Input jmlBrg, hrgSat
2 harga ← jmlBrg x hrgSat
3 Print harga
step Variabel Output
jmlBrg hrgSat harga
1 2 1500
2 2 1500 3000
3 2 1500 3000 3000
Contoh Branch (0)
step Instruksi
1 Input jmlBrg, hrgSat
2 IF jmlBrg lebih besar dari 100 THEN
3 harga <= 90% x jmlBrg x hrgSat
4 ELSE
5 harga <= jmlBrg x hrgSat
6 ENDIF
7 Print harga
step Variabel Next
step
Output
jmlBrg hrgSat harga
Contoh Branch (1)
step Instruksi
1 Input jmlBrg, hrgSat
2 IF jmlBrg lebih besar dari 100 THEN
3 harga ← 90% x jmlBrg x hrgSat
4 ELSE
5 harga ← jmlBrg x hrgSat
6 ENDIF
7 Print harga
step Variabel Next
step
Output
jmlBrg hrgSat harga
1 2 1500 2
Contoh Branch (2)
step Instruksi
1 Input jmlBrg, hrgSat
2 IF jmlBrg lebih besar dari 100 THEN
3 harga ← 90% x jmlBrg x hrgSat
4 ELSE
5 harga ← jmlBrg x hrgSat
6 ENDIF
7 Print harga
step Variabel Next
step
Output
jmlBrg hrgSat harga
1 2 1500 2
2 2 1500 5
Contoh Branch (3)
step Instruksi
1 Input jmlBrg, hrgSat
2 IF jmlBrg lebih besar dari 100 THEN
3 harga ← 90% x jmlBrg x hrgSat
4 ELSE
5 harga ← jmlBrg x hrgSat
6 ENDIF
7 Print harga
step Variabel Next step Output
jmlBrg hrgSat harga
1 2 1500 2
2 2 1500 5
5 2 1500 3000 6
Contoh Branch (4)
step Instruksi
1 Input jmlBrg, hrgSat
2 IF jmlBrg lebih besar dari 100 THEN
3 harga ← 90% x jmlBrg x hrgSat
4 ELSE
5 harga ← jmlBrg x hrgSat
6 ENDIF
7 Print harga
step Variabel Next step Output
jmlBrg hrgSat harga
1 2 1500 2
2 2 1500 5
5 2 1500 3000 6
6 2 1500 3000 7
Contoh Branch (5)
step Instruksi
1 Input jmlBrg, hrgSat
2 IF jmlBrg lebih besar dari 100 THEN
3 harga ← 90% x jmlBrg x hrgSat
4 ELSE
5 harga ← jmlBrg x hrgSat
6 ENDIF
7 Print harga
step Variabel Next step Output
jmlBrg hrgSat harga
1 2 1500 2
2 2 1500 5
5 2 1500 3000 6
6 2 1500 3000 7
7 2 1500 3000 selesai 3000
Contoh Loop (0)
• Akan dijalankan dengan input
– 2, 1500
– 6, 100
– 11, 2000
step Instruksi
1 Input jmlBrg, hrgSat
2 WHILE jmlBrg lebih kecil dari 10
3 Print ‘Tidak boleh kurang dari 10’
4 Input jmlBrg, hrgSat
5 END REPEAT
step Variabel Next step Output
jmlBrg hrgSat harga
Contoh Loop (1)
• Input pertama
– 2, 1500
• Input berikutnya
– 6, 100
– 11, 2000
step Instruksi
1 Input jmlBrg, hrgSat
2 WHILE jmlBrg lebih kecil dari 10
3 Print ‘Tidak boleh kurang dari 10’
4 Input jmlBrg, hrgSat
5 END REPEAT
step Variabel Next step Output
jmlBrg hrgSat harga
1 2 1500 2
Contoh Loop (2)
• Input berikutnya
– 6, 100
– 11, 2000
step Instruksi
1 Input jmlBrg, hrgSat
2 WHILE jmlBrg lebih kecil dari 10
3 Print ‘Tidak boleh kurang dari 10’
4 Input jmlBrg, hrgSat
5 END REPEAT
step Variabel Next step Output
jmlBrg hrgSat harga
1 2 1500 2
2 2 1500 3
Contoh Loop (3)
• Input berikutnya
– 6, 100
– 11, 2000
step Instruksi
1 Input jmlBrg, hrgSat
2 WHILE jmlBrg lebih kecil dari 10
3 Print ‘Tidak boleh kurang dari 10’
4 Input jmlBrg, hrgSat
5 END REPEAT
step Variabel Next
step
Output
jmlBrg hrgSat harga
1 2 1500 2
2 2 1500 3
3 2 1500 4 Tidak boleh kurang dari 10
Contoh Loop (4)
• Input sekarang
– 6, 100
• Input berikutnya
– 11, 2000
step Instruksi
1 Input jmlBrg, hrgSat
2 WHILE jmlBrg lebih kecil dari 10
3 Print ‘Tidak boleh kurang dari 10’
4 Input jmlBrg, hrgSat
5 END REPEAT
step Variabel Next
step
Output
jmlBrg hrgSat harga
1 2 1500 2
2 2 1500 3
3 2 1500 4 Tidak boleh kurang dari 10
4 6 100 5 Tidak boleh kurang dari 10
Contoh Loop (5)
• Input berikutnya
– 11, 2000
step Instruksi
1 Input jmlBrg, hrgSat
2 WHILE jmlBrg lebih kecil dari 10
3 Print ‘Tidak boleh kurang dari 10’
4 Input jmlBrg, hrgSat
5 END REPEAT
step Variabel Next
step
Output
jmlBrg hrgSat harga
1 2 1500 2
2 2 1500 3
3 2 1500 4 Tidak boleh kurang dari 10
4 6 100 5 Tidak boleh kurang dari 10
5 6 100 2
Contoh Loop (6)
• Input berikutnya
– 11, 2000
step Instruksi
1 Input jmlBrg, hrgSat
2 WHILE jmlBrg lebih kecil dari 10
3 Print ‘Tidak boleh kurang dari 10’
4 Input jmlBrg, hrgSat
5 END REPEAT
step Variabel Next
step
Output
jmlBrg hrgSat harga
1 2 1500 2
2 2 1500 3
3 2 1500 4 Tidak boleh kurang dari 10
4 6 100 5 Tidak boleh kurang dari 10
5 6 100 2 Tidak boleh kurang dari 10
2 6 100 3 Tidak boleh kurang dari 10
Contoh Loop (7)
• Input berikutnya
– 11, 2000
step Instruksi
1 Input jmlBrg, hrgSat
2 WHILE jmlBrg lebih kecil dari 10
3 Print ‘Tidak boleh kurang dari 10’
4 Input jmlBrg, hrgSat
5 END REPEAT
step Variabel Next step Output
jmlBrg hrgSat harga
1 2 1500 2
2 2 1500 3
3 2 1500 4 Tidak boleh kurang dari 10
4 6 100 5 Tidak boleh kurang dari 10
5 6 100 2 Tidak boleh kurang dari 10
2 6 100 3 Tidak boleh kurang dari 10
3 6 100 4 Tidak boleh kurang dari 10
Contoh Loop (8)
step Instruksi
1 Input jmlBrg, hrgSat
2 WHILE jmlBrg lebih kecil dari 10
3 Print ‘Tidak boleh kurang dari 10’
4 Input jmlBrg, hrgSat
5 END REPEAT
step Variabel Next step Output
jmlBrg hrgSat harga
1 2 1500 2
2 2 1500 3
3 2 1500 4 Tidak boleh kurang dari 10
4 6 100 5 Tidak boleh kurang dari 10
5 6 100 2 Tidak boleh kurang dari 10
2 6 100 3 Tidak boleh kurang dari 10
3 6 100 4 Tidak boleh kurang dari 10
4 11 2000 5 Tidak boleh kurang dari 10
Contoh Loop (9)
step Instruksi
1 Input jmlBrg, hrgSat
2 WHILE jmlBrg lebih kecil dari 10
3 Print ‘Tidak boleh kurang dari 10’
4 Input jmlBrg, hrgSat
5 END REPEAT
Step jmlBrg hrgSat harga Next step Output
1 2 1500 2
2 2 1500 3
3 2 1500 4 Tidak boleh kurang dari 10
4 6 100 5 Tidak boleh kurang dari 10
5 6 100 2 Tidak boleh kurang dari 10
2 6 100 3 Tidak boleh kurang dari 10
3 6 100 4 Tidak boleh kurang dari 10
4 11 2000 5 Tidak boleh kurang dari 10
5 11 2000 2 Tidak boleh kurang dari 10
Contoh Loop (10)
step Instruksi
1 Input jmlBrg, hrgSat
2 WHILE jmlBrg lebih kecil dari 10
3 Print ‘Tidak boleh kurang dari 10’
4 Input jmlBrg, hrgSat
5 END REPEAT
Step jmlBrg hrgSat harga Next step Output
1 2 1500 2
2 2 1500 3
3 2 1500 4 Tidak boleh kurang dari 10
4 6 100 5 Tidak boleh kurang dari 10
5 6 100 2 Tidak boleh kurang dari 10
2 6 100 3 Tidak boleh kurang dari 10
3 6 100 4 Tidak boleh kurang dari 10
4 11 2000 5 Tidak boleh kurang dari 10
5 11 2000 2 Tidak boleh kurang dari 10
2 11 2000 6
Kesalahan
• Syntax : tata bahasa
– Diinginkan: IF a > b THEN
– Tertulis : IF a -> b THEN
• Logical : algoritma
– Diinginkan: INPUT harga
– Tertulis : INPUT jumlah
• Numerical : perhitungan
– Original data
– Truncation
– Round off
– Propagated
Kesalahan
• Syntax : tata bahasa
• Logical : algoritma
• Numerical : perhitungan
– Original data
• Misal, input harga, seharusnya 5000
• Terrekam: 3999
– Truncation
• Misal, pi = 3,1415926535897932384626433832795
• Kapasitas memory hanya merekam pi=3,1415
– Round off
• Misal, pembulatan pi=3,14159 ... menjadi pi=3,1416
– Propagated
Bahasa Pemrograman
• Procedure oriented
– Procedure : sekumpulan langkah
– Function, routine, subroutine
– Contoh: pascal, C, basic
– Tools sofware: Tubo pascal, Tubo C, Visual
C, Turbo basic, visual basic
• Object oriented programming (OOP)
– Contoh: java, C++
– Tools software: netbean, Turbo J, Vj/c++
Bahasa Pemrograman
• Procedure oriented
• Object oriented programming (OOP), konsep:
– Class : user-defined type, object template, meta-object,
package, module, concept
• Komponen class
– (class) Properties / Attributes
– (class) Method / behaviour
• Inheritance : menuliskan class baru berdasarkan class yang sudah
ada.
– subclass
– superclass
– Object : class instance
• encapsulation
– polymorphism
Bahasa Pemrograman
• Procedure oriented
• Object oriented programming (OOP), konsep:
– Class : user-defined type, object template, meta-object, package, module, concept
– Object : class instance
– (object) Properties / Attributes : field, slot, instance variable, data member
– (object) Method : selector, handler, message handler, feature, member function, operation,
package operation
– (object) Event : object method that is activated by event.
– superclass : parent class
– subclass : child class, derived class
– Objects memiliki sifat umum:
– inheritance : subclassing, class specialization, derivation, semua karakteristik sebuah class
akan dimiliki oleh class lain yang dibuat-berdasarkan (diturunkan) class tersebut.
– encapsulation: sebuah object merupakan unit yang berdiri sendiri; object mencakup data
dan instruksi yang terkait; property, attribute, data dalam object memiliki privacy.
– polymorphism: setiap object memahami dan melaksanakan perintah-perintah yang
diterimanya, sesuai dengan method dan property object itu sendiri.
Catatan:

More Related Content

Viewers also liked

8th Media And Telecom Convergence Conference
8th Media And Telecom Convergence Conference8th Media And Telecom Convergence Conference
8th Media And Telecom Convergence ConferenceKrishna Gopal
 
8 krishna mohan gonuguntla 86--93
8 krishna mohan gonuguntla 86--938 krishna mohan gonuguntla 86--93
8 krishna mohan gonuguntla 86--93Alexander Decker
 
8th PreAlg - L57--Jan30
8th PreAlg - L57--Jan308th PreAlg - L57--Jan30
8th PreAlg - L57--Jan30jdurst65
 
8pdf
8pdf8pdf
8pdfxaky
 
Horizon 2020 cross modal funding research opportunities - Martin Brennan
Horizon 2020 cross modal funding research opportunities - Martin BrennanHorizon 2020 cross modal funding research opportunities - Martin Brennan
Horizon 2020 cross modal funding research opportunities - Martin BrennanKTN
 
8 herramients
8 herramients8 herramients
8 herramientsjunstas
 
8. isabel ii sexenio democrático
8. isabel ii  sexenio democrático8. isabel ii  sexenio democrático
8. isabel ii sexenio democráticomartahistoria
 
8 ot-du-futur
8 ot-du-futur8 ot-du-futur
8 ot-du-futursitlorpro
 
8 J Cooper Media, Tech Campaigns
8  J Cooper    Media,  Tech  Campaigns8  J Cooper    Media,  Tech  Campaigns
8 J Cooper Media, Tech CampaignsGordon Renouf
 
8ºK - Cláudia e Márcia
8ºK - Cláudia e Márcia8ºK - Cláudia e Márcia
8ºK - Cláudia e MárciaInformatica_
 
8K previously filed on May 25, 2006 which is the recast of 2005 10K
8K previously filed on May 25, 2006 which is the recast of 2005 10K8K previously filed on May 25, 2006 which is the recast of 2005 10K
8K previously filed on May 25, 2006 which is the recast of 2005 10KQuarterlyEarningsReports3
 

Viewers also liked (18)

8th Media And Telecom Convergence Conference
8th Media And Telecom Convergence Conference8th Media And Telecom Convergence Conference
8th Media And Telecom Convergence Conference
 
8 krishna mohan gonuguntla 86--93
8 krishna mohan gonuguntla 86--938 krishna mohan gonuguntla 86--93
8 krishna mohan gonuguntla 86--93
 
8e537 case questions sb
8e537 case questions sb8e537 case questions sb
8e537 case questions sb
 
8 Licensing & Misuse
8 Licensing & Misuse8 Licensing & Misuse
8 Licensing & Misuse
 
8 steps of concerns resolution
8 steps of concerns resolution8 steps of concerns resolution
8 steps of concerns resolution
 
8th PreAlg - L57--Jan30
8th PreAlg - L57--Jan308th PreAlg - L57--Jan30
8th PreAlg - L57--Jan30
 
8-MTH
8-MTH8-MTH
8-MTH
 
8pdf
8pdf8pdf
8pdf
 
8 krishnakumar.r 48-53
8 krishnakumar.r 48-538 krishnakumar.r 48-53
8 krishnakumar.r 48-53
 
Horizon 2020 cross modal funding research opportunities - Martin Brennan
Horizon 2020 cross modal funding research opportunities - Martin BrennanHorizon 2020 cross modal funding research opportunities - Martin Brennan
Horizon 2020 cross modal funding research opportunities - Martin Brennan
 
8 herramients
8 herramients8 herramients
8 herramients
 
8. isabel ii sexenio democrático
8. isabel ii  sexenio democrático8. isabel ii  sexenio democrático
8. isabel ii sexenio democrático
 
8 ot-du-futur
8 ot-du-futur8 ot-du-futur
8 ot-du-futur
 
8 J Cooper Media, Tech Campaigns
8  J Cooper    Media,  Tech  Campaigns8  J Cooper    Media,  Tech  Campaigns
8 J Cooper Media, Tech Campaigns
 
8ºK - Cláudia e Márcia
8ºK - Cláudia e Márcia8ºK - Cláudia e Márcia
8ºK - Cláudia e Márcia
 
8K previously filed on May 25, 2006 which is the recast of 2005 10K
8K previously filed on May 25, 2006 which is the recast of 2005 10K8K previously filed on May 25, 2006 which is the recast of 2005 10K
8K previously filed on May 25, 2006 which is the recast of 2005 10K
 
8 March 2010
8 March 20108 March 2010
8 March 2010
 
(8) negocios
(8) negocios(8) negocios
(8) negocios
 

More from EL Institute

pengertian-dan-ruang-lingkup-rancangan usaha agribisnis (rancua)
pengertian-dan-ruang-lingkup-rancangan usaha agribisnis (rancua)pengertian-dan-ruang-lingkup-rancangan usaha agribisnis (rancua)
pengertian-dan-ruang-lingkup-rancangan usaha agribisnis (rancua)EL Institute
 
Rancangan Usaha Agribisnis
Rancangan Usaha AgribisnisRancangan Usaha Agribisnis
Rancangan Usaha AgribisnisEL Institute
 
2 system-unit.ppt-compatibility-mode
2 system-unit.ppt-compatibility-mode2 system-unit.ppt-compatibility-mode
2 system-unit.ppt-compatibility-modeEL Institute
 
Programme closing meeting
Programme closing meetingProgramme closing meeting
Programme closing meetingEL Institute
 

More from EL Institute (10)

Fatkul
FatkulFatkul
Fatkul
 
pengertian-dan-ruang-lingkup-rancangan usaha agribisnis (rancua)
pengertian-dan-ruang-lingkup-rancangan usaha agribisnis (rancua)pengertian-dan-ruang-lingkup-rancangan usaha agribisnis (rancua)
pengertian-dan-ruang-lingkup-rancangan usaha agribisnis (rancua)
 
Rancangan Usaha Agribisnis
Rancangan Usaha AgribisnisRancangan Usaha Agribisnis
Rancangan Usaha Agribisnis
 
Dsar ti ke 4
Dsar ti ke 4Dsar ti ke 4
Dsar ti ke 4
 
Dsar ti ke 3
Dsar ti ke 3Dsar ti ke 3
Dsar ti ke 3
 
2 system-unit.ppt-compatibility-mode
2 system-unit.ppt-compatibility-mode2 system-unit.ppt-compatibility-mode
2 system-unit.ppt-compatibility-mode
 
Introduction
IntroductionIntroduction
Introduction
 
Omlclosereq
OmlclosereqOmlclosereq
Omlclosereq
 
Programme closing meeting
Programme closing meetingProgramme closing meeting
Programme closing meeting
 
Dsar ti
Dsar tiDsar ti
Dsar ti
 

8 pemrograman.ppt-compatibility-mode

  • 2. Dokumentasi • Flowchart: – Lambang, simbol, gambar – Arah panah • Pseudo code – Uraian sistematis dengan bahasa biasa
  • 3. Program Control Structure • Sequence structure • Branch structure • Loop structure
  • 4. Sequence • Instruksi dikerjakan secara berurutan. – dari atas ke bawah step Instruksi 1 Input jmlBrg, hrgSat 2 harga ← jmlBrg x hrgSat 3 Print harga
  • 5. Contoh Sequence (1) • Program akan dikerjakan dengan input: – 2, 1500 step Variabel Output jmlBrg hrgSat harga step Instruksi 1 Input jmlBrg, hrgSat 2 harga ← jmlBrg x hrgSat 3 Print harga
  • 6. Contoh Sequence (2) • Mulai dengan langkah-1: – Input 2, 1500 step Instruksi 1 Input jmlBrg, hrgSat 2 harga ← jmlBrg x hrgSat 3 Print harga step Variabel Output jmlBrg hrgSat harga 1 2 1500
  • 7. Contoh Sequence (3) • Langkah-2: – Hitung perkalian, simpan hasilnya di variabel harga step Instruksi 1 Input jmlBrg, hrgSat 2 harga ← jmlBrg x hrgSat 3 Print harga step Variabel Output jmlBrg hrgSat harga 1 2 1500 2 2 1500 3000
  • 8. Contoh Sequence (4) • Langkah-3: – Tampilkan isi variabel harga step Instruksi 1 Input jmlBrg, hrgSat 2 harga ← jmlBrg x hrgSat 3 Print harga step Variabel Output jmlBrg hrgSat harga 1 2 1500 2 2 1500 3000 3 2 1500 3000 3000
  • 9. Contoh Branch (0) step Instruksi 1 Input jmlBrg, hrgSat 2 IF jmlBrg lebih besar dari 100 THEN 3 harga <= 90% x jmlBrg x hrgSat 4 ELSE 5 harga <= jmlBrg x hrgSat 6 ENDIF 7 Print harga step Variabel Next step Output jmlBrg hrgSat harga
  • 10. Contoh Branch (1) step Instruksi 1 Input jmlBrg, hrgSat 2 IF jmlBrg lebih besar dari 100 THEN 3 harga ← 90% x jmlBrg x hrgSat 4 ELSE 5 harga ← jmlBrg x hrgSat 6 ENDIF 7 Print harga step Variabel Next step Output jmlBrg hrgSat harga 1 2 1500 2
  • 11. Contoh Branch (2) step Instruksi 1 Input jmlBrg, hrgSat 2 IF jmlBrg lebih besar dari 100 THEN 3 harga ← 90% x jmlBrg x hrgSat 4 ELSE 5 harga ← jmlBrg x hrgSat 6 ENDIF 7 Print harga step Variabel Next step Output jmlBrg hrgSat harga 1 2 1500 2 2 2 1500 5
  • 12. Contoh Branch (3) step Instruksi 1 Input jmlBrg, hrgSat 2 IF jmlBrg lebih besar dari 100 THEN 3 harga ← 90% x jmlBrg x hrgSat 4 ELSE 5 harga ← jmlBrg x hrgSat 6 ENDIF 7 Print harga step Variabel Next step Output jmlBrg hrgSat harga 1 2 1500 2 2 2 1500 5 5 2 1500 3000 6
  • 13. Contoh Branch (4) step Instruksi 1 Input jmlBrg, hrgSat 2 IF jmlBrg lebih besar dari 100 THEN 3 harga ← 90% x jmlBrg x hrgSat 4 ELSE 5 harga ← jmlBrg x hrgSat 6 ENDIF 7 Print harga step Variabel Next step Output jmlBrg hrgSat harga 1 2 1500 2 2 2 1500 5 5 2 1500 3000 6 6 2 1500 3000 7
  • 14. Contoh Branch (5) step Instruksi 1 Input jmlBrg, hrgSat 2 IF jmlBrg lebih besar dari 100 THEN 3 harga ← 90% x jmlBrg x hrgSat 4 ELSE 5 harga ← jmlBrg x hrgSat 6 ENDIF 7 Print harga step Variabel Next step Output jmlBrg hrgSat harga 1 2 1500 2 2 2 1500 5 5 2 1500 3000 6 6 2 1500 3000 7 7 2 1500 3000 selesai 3000
  • 15. Contoh Loop (0) • Akan dijalankan dengan input – 2, 1500 – 6, 100 – 11, 2000 step Instruksi 1 Input jmlBrg, hrgSat 2 WHILE jmlBrg lebih kecil dari 10 3 Print ‘Tidak boleh kurang dari 10’ 4 Input jmlBrg, hrgSat 5 END REPEAT step Variabel Next step Output jmlBrg hrgSat harga
  • 16. Contoh Loop (1) • Input pertama – 2, 1500 • Input berikutnya – 6, 100 – 11, 2000 step Instruksi 1 Input jmlBrg, hrgSat 2 WHILE jmlBrg lebih kecil dari 10 3 Print ‘Tidak boleh kurang dari 10’ 4 Input jmlBrg, hrgSat 5 END REPEAT step Variabel Next step Output jmlBrg hrgSat harga 1 2 1500 2
  • 17. Contoh Loop (2) • Input berikutnya – 6, 100 – 11, 2000 step Instruksi 1 Input jmlBrg, hrgSat 2 WHILE jmlBrg lebih kecil dari 10 3 Print ‘Tidak boleh kurang dari 10’ 4 Input jmlBrg, hrgSat 5 END REPEAT step Variabel Next step Output jmlBrg hrgSat harga 1 2 1500 2 2 2 1500 3
  • 18. Contoh Loop (3) • Input berikutnya – 6, 100 – 11, 2000 step Instruksi 1 Input jmlBrg, hrgSat 2 WHILE jmlBrg lebih kecil dari 10 3 Print ‘Tidak boleh kurang dari 10’ 4 Input jmlBrg, hrgSat 5 END REPEAT step Variabel Next step Output jmlBrg hrgSat harga 1 2 1500 2 2 2 1500 3 3 2 1500 4 Tidak boleh kurang dari 10
  • 19. Contoh Loop (4) • Input sekarang – 6, 100 • Input berikutnya – 11, 2000 step Instruksi 1 Input jmlBrg, hrgSat 2 WHILE jmlBrg lebih kecil dari 10 3 Print ‘Tidak boleh kurang dari 10’ 4 Input jmlBrg, hrgSat 5 END REPEAT step Variabel Next step Output jmlBrg hrgSat harga 1 2 1500 2 2 2 1500 3 3 2 1500 4 Tidak boleh kurang dari 10 4 6 100 5 Tidak boleh kurang dari 10
  • 20. Contoh Loop (5) • Input berikutnya – 11, 2000 step Instruksi 1 Input jmlBrg, hrgSat 2 WHILE jmlBrg lebih kecil dari 10 3 Print ‘Tidak boleh kurang dari 10’ 4 Input jmlBrg, hrgSat 5 END REPEAT step Variabel Next step Output jmlBrg hrgSat harga 1 2 1500 2 2 2 1500 3 3 2 1500 4 Tidak boleh kurang dari 10 4 6 100 5 Tidak boleh kurang dari 10 5 6 100 2
  • 21. Contoh Loop (6) • Input berikutnya – 11, 2000 step Instruksi 1 Input jmlBrg, hrgSat 2 WHILE jmlBrg lebih kecil dari 10 3 Print ‘Tidak boleh kurang dari 10’ 4 Input jmlBrg, hrgSat 5 END REPEAT step Variabel Next step Output jmlBrg hrgSat harga 1 2 1500 2 2 2 1500 3 3 2 1500 4 Tidak boleh kurang dari 10 4 6 100 5 Tidak boleh kurang dari 10 5 6 100 2 Tidak boleh kurang dari 10 2 6 100 3 Tidak boleh kurang dari 10
  • 22. Contoh Loop (7) • Input berikutnya – 11, 2000 step Instruksi 1 Input jmlBrg, hrgSat 2 WHILE jmlBrg lebih kecil dari 10 3 Print ‘Tidak boleh kurang dari 10’ 4 Input jmlBrg, hrgSat 5 END REPEAT step Variabel Next step Output jmlBrg hrgSat harga 1 2 1500 2 2 2 1500 3 3 2 1500 4 Tidak boleh kurang dari 10 4 6 100 5 Tidak boleh kurang dari 10 5 6 100 2 Tidak boleh kurang dari 10 2 6 100 3 Tidak boleh kurang dari 10 3 6 100 4 Tidak boleh kurang dari 10
  • 23. Contoh Loop (8) step Instruksi 1 Input jmlBrg, hrgSat 2 WHILE jmlBrg lebih kecil dari 10 3 Print ‘Tidak boleh kurang dari 10’ 4 Input jmlBrg, hrgSat 5 END REPEAT step Variabel Next step Output jmlBrg hrgSat harga 1 2 1500 2 2 2 1500 3 3 2 1500 4 Tidak boleh kurang dari 10 4 6 100 5 Tidak boleh kurang dari 10 5 6 100 2 Tidak boleh kurang dari 10 2 6 100 3 Tidak boleh kurang dari 10 3 6 100 4 Tidak boleh kurang dari 10 4 11 2000 5 Tidak boleh kurang dari 10
  • 24. Contoh Loop (9) step Instruksi 1 Input jmlBrg, hrgSat 2 WHILE jmlBrg lebih kecil dari 10 3 Print ‘Tidak boleh kurang dari 10’ 4 Input jmlBrg, hrgSat 5 END REPEAT Step jmlBrg hrgSat harga Next step Output 1 2 1500 2 2 2 1500 3 3 2 1500 4 Tidak boleh kurang dari 10 4 6 100 5 Tidak boleh kurang dari 10 5 6 100 2 Tidak boleh kurang dari 10 2 6 100 3 Tidak boleh kurang dari 10 3 6 100 4 Tidak boleh kurang dari 10 4 11 2000 5 Tidak boleh kurang dari 10 5 11 2000 2 Tidak boleh kurang dari 10
  • 25. Contoh Loop (10) step Instruksi 1 Input jmlBrg, hrgSat 2 WHILE jmlBrg lebih kecil dari 10 3 Print ‘Tidak boleh kurang dari 10’ 4 Input jmlBrg, hrgSat 5 END REPEAT Step jmlBrg hrgSat harga Next step Output 1 2 1500 2 2 2 1500 3 3 2 1500 4 Tidak boleh kurang dari 10 4 6 100 5 Tidak boleh kurang dari 10 5 6 100 2 Tidak boleh kurang dari 10 2 6 100 3 Tidak boleh kurang dari 10 3 6 100 4 Tidak boleh kurang dari 10 4 11 2000 5 Tidak boleh kurang dari 10 5 11 2000 2 Tidak boleh kurang dari 10 2 11 2000 6
  • 26. Kesalahan • Syntax : tata bahasa – Diinginkan: IF a > b THEN – Tertulis : IF a -> b THEN • Logical : algoritma – Diinginkan: INPUT harga – Tertulis : INPUT jumlah • Numerical : perhitungan – Original data – Truncation – Round off – Propagated
  • 27. Kesalahan • Syntax : tata bahasa • Logical : algoritma • Numerical : perhitungan – Original data • Misal, input harga, seharusnya 5000 • Terrekam: 3999 – Truncation • Misal, pi = 3,1415926535897932384626433832795 • Kapasitas memory hanya merekam pi=3,1415 – Round off • Misal, pembulatan pi=3,14159 ... menjadi pi=3,1416 – Propagated
  • 28. Bahasa Pemrograman • Procedure oriented – Procedure : sekumpulan langkah – Function, routine, subroutine – Contoh: pascal, C, basic – Tools sofware: Tubo pascal, Tubo C, Visual C, Turbo basic, visual basic • Object oriented programming (OOP) – Contoh: java, C++ – Tools software: netbean, Turbo J, Vj/c++
  • 29. Bahasa Pemrograman • Procedure oriented • Object oriented programming (OOP), konsep: – Class : user-defined type, object template, meta-object, package, module, concept • Komponen class – (class) Properties / Attributes – (class) Method / behaviour • Inheritance : menuliskan class baru berdasarkan class yang sudah ada. – subclass – superclass – Object : class instance • encapsulation – polymorphism
  • 30. Bahasa Pemrograman • Procedure oriented • Object oriented programming (OOP), konsep: – Class : user-defined type, object template, meta-object, package, module, concept – Object : class instance – (object) Properties / Attributes : field, slot, instance variable, data member – (object) Method : selector, handler, message handler, feature, member function, operation, package operation – (object) Event : object method that is activated by event. – superclass : parent class – subclass : child class, derived class – Objects memiliki sifat umum: – inheritance : subclassing, class specialization, derivation, semua karakteristik sebuah class akan dimiliki oleh class lain yang dibuat-berdasarkan (diturunkan) class tersebut. – encapsulation: sebuah object merupakan unit yang berdiri sendiri; object mencakup data dan instruksi yang terkait; property, attribute, data dalam object memiliki privacy. – polymorphism: setiap object memahami dan melaksanakan perintah-perintah yang diterimanya, sesuai dengan method dan property object itu sendiri.