pemrograman visualminggu …4… page 1 minggu ke empat pemrograman visual pokok bahasan: control...

Post on 19-Jan-2016

218 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Minggu …4… Page 1

Pemrograman Visual

MINGGU Ke Empat

Pemrograman VisualPemrograman Visual

Pokok Bahasan:Control Statement I

Tujuan Instruksional Khusus:Mahasiswa dapat menjelaskan dan mengaplikasikan konsep control statement I pada Visual Basic 2008

Referensi:Deitel Deitel, Visual Basic 2008 (2009), How to Program, Prentice Hall. Chapter 5

Pemrograman Visual Minggu …4… Page 2

Agenda• If … Then Selection Statement• If … Then … Else Selection Statement• While Repetition Statement• Do While … Loop Repetition Statement • Do Until … Loop Repetition Statement• Compound Assignment Operators• Nested Control Statement• Nested Repetition Statement

Pemrograman Visual Minggu …4… Page 3

If/Then Selection Structure

grade>=60 Console.writeLine(“Passed”)

If studentGrade>=60 Then

Console.WriteLine(“Passed”)

End If

True

False

Pemrograman Visual Minggu …4… Page 4

If/Then/Else Selection Structure

grade>=60 Console.writeLine(“Passed”)

If studentGrade>=60 Then

Console.WriteLine(“Passed”)

Else

Console.WriteLine(“Failed”)

End If

Console.writeLine(“Failed)

TrueFalse

Pemrograman Visual Minggu …4… Page 5

While Repetition Structure

Product<=1000 Product=Product*2

Dim Product as Integer=2

While Product<=1000

Console.Write(“{0}”, Product)

Product=Product*2

End While

True

False

Pemrograman Visual Minggu …4… Page 6

Do While/Loop Repetition Structure

Product<=1000 Product=Product*2

Dim Product as Integer=2

Do While Product<=1000

Console.Write(“{0}”, Product)

Product=Product*2

End While

True

False

Pemrograman Visual Minggu …4… Page 7

Do Until/Loop Repetition Structure

Product > 1000 Product=Product*2

Dim Product as Integer=2

Do Until Product > 1000

Console.Write(“{0}”, Product)

Product=Product*2

End While

False

True

Pemrograman Visual Minggu …4… Page 8

Demo While Statement

Pemrograman Visual Minggu …4… Page 9

Demo Do While

Pemrograman Visual Minggu …4… Page 10

Demo Do Until

Pemrograman Visual Minggu …4… Page 11

Compound Assignment Operator• Visual Basic provides the compound assignment

operator for abbreviating assignment statements eq. +=, -=, *=, /=, \=, ^= and &=

Pemrograman Visual Minggu …4… Page 12

Nested Control Statement

Pemrograman Visual Minggu …4… Page 13

Test Program for Class Analysis

Pemrograman Visual Minggu …4… Page 14

Nested Repetition Statement

Pemrograman Visual Minggu …4… Page 15

Questions

&

Answers

Pemrograman Visual Minggu …4… Page 16

Thank You

top related