Senin, 07 Maret 2011

Selection

Selection
Struktur Kontrol Selection / Pemilihan
     Ada beberapa variasi dari struktur kontrol selection yaitu:

  • Simple Selection (simple IF Statement)
  • Simple Selection tanpa cabang
  • Combined Selection
  • Nested Selection
  • Linear Nested IF Statement
  • Non-Linear IF Statement

1. Simple Selection
Simple selection terjadi jika harus memilih diantara dua alternatif yang ada, tergantung dari hasil kondisi apakah True atau false.
Keyword yang digunakan adalah : IF, THEN, ELSE, dan END IF

Contoh
IF saldo < $300 THEN
    bunga = 0.05
ELSE
    bunga = 0.1
ENDIF

2. Simple Selection Tanpa Cabang
Simple selection ini terjadi jika sebuah statement hanya bisa dikerjakan bila kondisinya adalah TRUE
Contoh:
IF Saldo > $300 THEN
    bunga = saldo * 0.1
ENDIF
           
3. Combined Selection
        Combined Selection terjadi jika kondisi yang harus diperiksa lebih dari satu. Kondisi tersebut dapat dihubungkan dengan menggunakan AND atau OR.

Contoh:
IF saldo > 300 AND kode = 1 THEN
    bunga = saldo * 0.1
ELSE
    bunga = saldo * 0.05
ENDIF
Statement bunga = saldo *0.1, akan bisa dikerjakan jika kedua kondisi yaitu saldo > 300 dan Kode = 1 bernilai TRUE. Hal ini dikarenakan penghubung yang digunakan adalah AND 

3. Nested Selection 
Tabel kebenaran
Nested selection terjadi, jika di dalam IF terdapat statement IF yang lain.
Ada dua jenis nested selection
Linear Nested IF statement
Non-Linear Nested IF statement
Linear Nested IF Statement
Linear Nested terjadi jika satu kondisi di cek untuk beberapa nilai.
Contoh:
        IF record_code=‘A’ THEN
             increment counter_A
        ELSE
             IF record_code=‘B’ THEN
                     increment counter_B
            ELSE
                     IF record_code=‘C’ THEN
                             increment counter _C
                     ELSE
                             increment error_counter
                    ENDIF
                ENDIF
       ENDIF

Non-Linear Nested IF
Non-Linear Nested IF Statement terjadi jika beberapa kondisi harus diperiksa sebelum suatu statement dikerjakan.
Contoh
IF student_attendance=part_time THEN
        IF student_gender=female THEN
            IF student_age >21 THEN
            add 1 to mature_fem_pt_students
            ELSE
            add 1 to young_fem_pt_students
            ENDIF
         ELSE
            add 1 to male_pt_students
         ENDIF
ELSE
       add 1 to full_time_students
ENDIF




Tugas : buat contoh lain selain contoh di atas untuk :
  • Simple Selection (simple IF Statement)
  • Simple Selection tanpa cabang
  • Combined Selection
  • Nested Selection
  • Linear Nested IF Statement
  • Non-Linear IF Statement

26 komentar:

  1. Abdul Rochman 902_MI
    091131069

    1./ Contoh dari Simple selection(simple IF Statment)
    If Ukuran < 600cm THEN
    Panjang x Lebar = 30x15
    Else
    Panjang x Lebar = 450
    ENDIF

    2./ Contoh dari Simple Selection tanpa cabang
    If Ukuran > 600cm THEN
    Panjang x Lebar = ukuran*450
    ENDIF

    3./ Contoh dari Combined Selection
    If Ukuran < 600cm OR kode = 3THEN
    Panjang x Lebar = Ukuran*450
    ELSE
    Panjang x Lebar = Ukuran*30x15
    ENDIF

    4./ Contoh dari Nested Selection/Linear Nested If Statement
    If Car_colour='White'THEN
    Increment counter_White
    Else
    If Car_colour='Blue'THEN
    Increment counter_Blue
    Else
    If Car_colour='Yellow'THEN
    Increment counter_Yellow
    Else
    Increment error_counter
    ENDIF
    ENDIF
    ENDIF

    5./ Contoh dari Nested Selection/Non-Linear If Statement
    If Students_attendance=Happy_Brihtday THEN
    If students_gender=male THEN
    If students_age>19 THEN
    Add 1 to mature_mal_hb_students
    Else
    Add 1 to young _mal_hb_students
    ENDIF
    Else
    Add 1 to female_hb_students
    ENDIF
    Else
    Add 1 to full_time_students
    ENDIF

    BalasHapus
  2. Nama : Ria Apriyani
    Kelas : 902 MI
    NIM : 091131121.



    1. Contoh dari Simple selection(simple IF Statment):
    If Harga < RP.100.000 THEN
    Harga 1 + Harga 2 = Rp. 40.000 + Rp. 30.000
    Else
    Total Harga = Rp. 70.000
    ENDIF



    2. Contoh dari Simple Selection tanpa cabang :
    If Harga > Rp. 100.000 THEN
    Harga 1 + Harga 2 = Total Harga*70.000
    ENDIF



    3. Contoh dari Combined Selection :
    If Harga < Rp. 100.000 OR kode = 2THEN
    Harga 1 + Harga 2 = Total Harga*70000
    ELSE
    Harga 1 + Harga 2 = Total Harga*40000+30000
    ENDIF



    4. Contoh dari Nested Selection/Linear Nested If Statement :
    If Shirt_colour='Red'THEN
    Increment shop_Red
    Else
    If Shirt_colour='Green'THEN
    Increment Shop_Green
    Else
    If Shirt_colour='Purple'THEN
    Increment Shop_Purple
    Else
    Increment error_shop
    ENDIF
    ENDIF
    ENDIF



    5. Contoh dari Nested Selection/Non-Linear If Statement :
    If students_attendance=flag_ceremony THEN
    If students_gender=female THEN
    If students_age>12 THEN
    Add 1 to mature_fem_fc_students
    Else
    Add 1 to young _fem_fc_students
    ENDIF
    Else
    Add 1 to male_fc_students
    ENDIF
    Else
    Add 1 to full_time_students
    ENDIF

    BalasHapus
  3. Nama : Wiyarno
    Kelas : 902 MI
    NIM : 091131118


    1) Contoh dari Simple selection(simple IF Statment):

    If Ukuran < 60cm THEN
    Panjang X Lebar = 9 X 5
    Else
    Panjang X Lebar = 45
    ENDIF




    2) Contoh dari Simple Selection tanpa cabang

    If Ukuran > 60cm THEN
    Panjang X Lebar = ukuran*45
    ENDIF





    3) Contoh dari Combined Selection :

    If Ukuran < 60cm OR kode = 2THEN
    Panjang X Lebar = Ukuran*45
    ELSE
    Panjang X Lebar = Ukuran*9 X 5
    ENDIF




    4) Contoh dari Nested Selection/Linear Nested If Statement :

    If bike_colour='Grey'THEN
    Increment counter_Grey
    Else
    If bike_colour='Black'THEN
    Increment counter_Black
    Else
    If bike_colour='Orange'THEN
    Increment counter_orange
    Else
    Increment error_counter
    ENDIF
    ENDIF
    ENDIF



    5) Contoh dari Nested Selection/Non-Linear If Statement :

    If Teachers_attendance=meeting THEN
    If teachers_gender=male THEN
    If teacher_age>45 THEN
    Add 1 to mature_mal_meet_teachers
    Else
    Add 1 to young _mal_meet_teachers
    ENDIF
    Else
    Add 1 to female_meet_teachers
    ENDIF
    Else
    Add 1 to full_time_teachers
    ENDIF

    BalasHapus
  4. Nama : Suci Handayani
    kelas: 902 MI (malam)
    Nim : 091131016


    note: ini menurut saya pak inay, jika ada kesalahan mohon dikoreksi dan diperbaiki. makasih

    1) Contoh dari Simple selection(simple IF Statment):

    IF jumlah harga belanja < Rp. 500.000 THEN
    discount = 5%
    ELSE
    discount = 10%
    ENDIF


    2. Contoh dari Simple Selection tanpa cabang

    IF jumlah harga belanja > Rp. 500.000 THEN
    discount = j.harga belanja*10%
    ENDIF


    3. Contoh dari Combined Selection :

    IF jumlah harga belanja > Rp. 500.000 AND KODE= 1 THEN
    discount = j. harga belanja*10%
    ELSE
    discount = j. harga belanja*5%
    ENDIF


    4. Contoh dari Nested Selection/Linear Nested If Statement :

    IF bag_colour='black'THEN
    Increment boutique_black
    ELSE
    IF bag_colour='red'THEN
    Increment boutique_red
    ElSE
    IF bag_colour='white'THEN
    Increment boutique_white
    ELSE
    Increment error_boutique
    ENDIF
    ENDIF
    ENDIF


    5. Contoh dari Nested Selection/Non-Linear If Statement :

    IF workers_attendance=part_time THEN
    IF workers_gender=female THEN
    IF workers_age >35 THEN
    add 1 to mature_fem_pt_workers
    ELSE
    add 1 to young_fem_pt_workers
    ENDIF
    ELSE
    add 1 to male_pt_workers
    ENDIF
    ELSE
    add 1 to full_time_workers
    ENDIF



    :)

    BalasHapus
  5. +Simple Selection
    IF saldo < $600 THEN
    bunga = 0.6
    ELSE
    bunga = 0.2
    END IF

    +Simple Selection Tanpa Cabang
    IF Saldo > $600 THEN
    bunga = saldo 0.2
    ENDIF

    +Combined Selection
    IF saldo > 600 AND kode = 2 THEN
    bunga = saldo * 0.2

    ELSE
    bunga = saldo * 0.06
    ENDIF

    +nested Selection
    IF record_code=‘D’ THEN
    increment counter_D
    ELSE
    IF record_code=‘E’ THEN
    increment counter_E
    ELSE
    IF record_code=‘F’ THEN
    increment counter _E
    ELSE
    increment error_counter
    ENDIF
    ENDIF
    ENDIF

    + Non Linear IF statement
    if Profesor_attendence=part_time then
    if Profesor_gender=female then
    if Profesor_age>45 then
    add 1 to math_female_pt_Profesor
    else
    add 1 to old_female_pt_Profesor
    end if
    else
    add 1 to male_pt_Profesor
    add 1 to full_time_Profesor
    end if

    BalasHapus
  6. Nama:Ismail
    kelas:902/MI (MALAM)
    NIM:091131119


    note: ini menurut saya pak inay, jika ada kesalahan mohon dikoreksi dan diperbaiki. makasih

    1) Contoh dari Simple selection(simple IF Statment):

    IF jumlah harga belanja < Rp. 50.000 THEN
    discount = 5%
    ELSE
    discount = 10%
    ENDIF


    2. Contoh dari Simple Selection tanpa cabang

    IF jumlah harga belanja > Rp. 50.000 THEN
    discount = beli.harga belanja*10%
    ENDIF


    3. Contoh dari Combined Selection :

    IF jumlah harga belanja > Rp. 50.000 AND KODE= 1 THEN
    discount = beli. harga belanja*10%
    ELSE
    discount = beli. harga belanja*5%
    ENDIF


    4. Contoh dari Nested Selection/Linear Nested If Statement :

    IF bag_colour='black'THEN
    Increment boutique_black
    ELSE
    IF bag_colour='red'THEN
    Increment boutique_red
    ElSE
    IF bag_colour='white'THEN
    Increment boutique_white
    ELSE
    Increment error_boutique
    ENDIF
    ENDIF
    ENDIF


    5. Contoh dari Nested Selection/Non-Linear If Statement :

    IF workers_attendance=part_time THEN
    IF workers_gender=female THEN
    IF workers_age >35 THEN
    add 1 to mature_fem_pt_teacher
    ELSE
    add 1 to young_fem_pt_teacher
    ENDIF
    ELSE
    add 1 to male_pt_teacher
    ENDIF
    ELSE
    add 1 to full_time_teacher
    ENDIF

    BalasHapus
  7. fahmi isra saputra
    MI_902
    031131088

    ^> Contoh dari Simple selection(simple IF Statment):
    IF harga tiket pesawat < Rp. 400.000 THEN
    discount = 5%
    ELSE
    discount = 10%
    ENDIF


    ^> Contoh dari Simple Selection tanpa cabang
    IF harga tiket pesawat > Rp. 400.000 THEN
    discount = beli.harga tiket pesawat*10%
    ENDIF


    ^> Contoh dari Combined Selection :
    IF harga tiket pesawat > Rp. 400.000 AND KODE= 1 THEN
    discount = beli. harga tiket pesawat*10%
    ELSE
    discount = beli. harga tiket pesawat*5%
    ENDIF


    ^> Contoh dari Nested Selection/Linear Nested If Statement :
    IF pesawat_lionair='surabaya'THEN
    Increment pesawat_surabaya
    ELSE
    IF pesawat_lionair='jogja'THEN
    Increment pesawat_jogja
    ElSE
    IF pesawat_lionair='semarang'THEN
    Increment pesawat_semarang
    ELSE
    Increment error_pesawat
    ENDIF
    ENDIF
    ENDIF


    ^> Contoh dari Nested Selection/Non-Linear If Statement :
    If Students_attendance=Happy_Brihtday THEN
    If students_gender=male THEN
    If students_age>19 THEN
    Add 1 to mature_mal_hb_students
    Else
    Add 1 to young _mal_hb_students
    ENDIF
    Else
    Add 1 to female_hb_students
    ENDIF
    Else
    Add 1 to full_time_students
    ENDIF

    BalasHapus
  8. Komentar ini telah dihapus oleh pengarang.

    BalasHapus
  9. Komentar ini telah dihapus oleh pengarang.

    BalasHapus
  10. Nama : Wahyu Hidayat
    kelas : 902
    nim : 091131029

    c/ simple selection

    if masa_kerja >3tahun then
    tunjagan_pokok = Rp 800.000,-
    else
    tunjangan_pokok= Rp 500.000,-
    Endif

    c/ simple selection tanpa cabang

    if masa_kerja > 3tahun then
    tunjangan_pokok= RP 800.000,-
    endif

    c/ combine selection
    if masa_kerja >3tahun and kode= a then
    tunjangan_pokok = Rp 800.000,-
    else
    Tunjangan_pokok = Rp 500.000,-
    endif

    C/ Nested Selection/Linear Nested If Statement :

    if record_code=1 then
    add to counter_1
    else
    if record_code=2 then
    add 1 to counter_2
    else
    if record_code=3 then
    add 1 to counter_3
    else
    error_counter
    endif
    endif
    endif


    C/ Nested Selection/Non-Linear If Statement

    if Jns_kel = laki-laki then
    if usia <25_tahun then
    add 1 to laki_muda
    if age =>25_tahun
    add 1 to Laki2_dewasa
    endif
    else
    add 1 to Wanita
    endif

    (mohon di koreksi pak salah dan benarnya)
    شكرا

    BalasHapus
  11. revisi pak ada yang salah ketik u/
    c/ simple selection

    if masa_kerja >3tahun then
    tunjangan_pokok = Rp 800.000,-
    else
    tunjangan_pokok= Rp 500.000,-
    Endif

    makasih pak..

    BalasHapus
  12. NAMA: eka aditya saputra
    CLASS:902(MI)
    NIM:091130962

    1>EXAMPLE simple selection
    if harga_kost >1tahun then
    iuran_listrik = Rp. 700.000,-
    else
    iuran_listrik = Rp. 900.000,-
    endif

    2>EXAMPLE simple selection tanpa cabang
    if harga_kost >1tahun then
    iuran_listrik = Rp. 700.000,-

    3>EXAMPLE combine selection
    if harga kost >1tahun and code=a then
    iuran_listrik = Rp. 700.000,-
    else
    iuran_listrik = Rp. 900.000,-

    4>EXAMPLE nested selection/linear nested if statement:
    if record_code=then
    add to counter_1
    else
    if record_code_2then
    add 1 to counter_2
    else
    if record_code_3
    if 1 to counter_3
    else
    error_counter
    endif
    endif
    endif

    5>EXAMPLE nested selection/non-linear if statement:
    if jns_brg = televisi
    if harga 1500.000_rupiah
    endif
    else
    end if

    BalasHapus
  13. 1./ Contoh dari Simple selection(simple IF Statment)
    If Ukuran < 500cm THEN
    Panjang x Lebar = 20x15
    Else
    Panjang x Lebar = 300
    ENDIF

    2./ Contoh dari Simple Selection tanpa cabang
    If Ukuran > 500cm THEN
    Panjang x Lebar = ukuran*300
    ENDIF

    3./ Contoh dari Combined Selection
    If Ukuran < 500cm OR kode = 2THEN
    Panjang x Lebar = Ukuran*300
    ELSE
    Panjang x Lebar = Ukuran*20x15
    ENDIF

    4./ Contoh dari Nested Selection/Linear Nested If Statement
    If tshirt_colour='White'THEN
    Increment counter_White
    Else
    If t-shirt_colour='Blue'THEN
    Increment counter_Blue
    Else
    If T-shirt_colour='Yellow'THEN
    Increment counter_Yellow
    Else
    Increment error_counter
    ENDIF
    ENDIF
    ENDIF

    5./ Contoh dari Nested Selection/Non-Linear If Statement
    If Students_attendance=LEBARAN THEN
    If students_gender=FEMALE THEN
    If students_age>20 THEN
    Add 1 to mature_mal_hb_students
    Else
    Add 1 to young _mal_hb_students
    ENDIF
    Else
    Add 1 to female_hb_students
    ENDIF
    Else
    Add 1 to full_time_studen

    BalasHapus
  14. Nama:MUHAMMAD RIDWAN
    Klz:902
    NIM:091130988

    1) Contoh dari Simple selection(simple IF Statment):

    IF jumlah harga belanja < Rp. 500.000 THEN
    discount = 5%
    ELSE
    discount = 10%
    ENDIF

    2)Contoh dari Simple Selection tanpa cabang
    If Ukuran > 500cm THEN
    Panjang x Lebar = ukuran*300
    ENDIF


    3)Contoh dari Combined Selection :

    IF jumlah harga belanja > Rp. 500.000 AND KODE= 1 THEN
    discount = j. harga belanja*10%
    ELSE
    discount = j. harga belanja*5%
    ENDIF


    4)Contoh dari Nested Selection/Linear Nested If Statement
    If Car_colour='White'THEN
    Increment counter_White
    Else
    If Car_colour='Blue'THEN
    Increment counter_Blue
    Else
    If Car_colour='Yellow'THEN
    Increment counter_Yellow
    Else
    Increment error_counter
    ENDIF
    ENDIF

    5)Contoh dari Nested Selection/Non-Linear If Statement :

    IF workers_attendance=part_time THEN
    IF workers_gender=female THEN
    IF workers_age >35 THEN
    add 1 to mature_fem_pt_teacher
    ELSE
    add 1 to young_fem_pt_teacher
    ENDIF
    ELSE
    add 1 to male_pt_teacher
    ENDIF
    ELSE
    add 1 to full_time_teacher
    ENDIF

    BalasHapus
  15. Nama : Widya arifah sarah
    kelas : 902
    nim : 091131031

    contoh/ simple selection

    if masa_kerja >2 tahun then
    gaji = Rp 2.000.000,-
    else
    gaji = Rp 1.000.000,-
    Endif

    contoh/ simple selection tanpa cabang

    if masa_kerja > 2tahun then
    gaji = RP 2.000.000,-
    endif

    conoth/ combine selection
    if masa_kerja >2 tahun and kode= 1 then
    gaji = Rp 2.000.000,-
    else
    gaji = Rp 1.000.000,-
    endif

    Contoh Nested Selection/Linear Nested If Statement :
    If Shoe_colour='pink'THEN
    Increment shop_pink
    Else
    If Shoe_colour='blue'THEN
    Increment Shop_blue
    Else
    If Shoe_colour='black'THEN
    Increment Shop_black
    Else
    Increment error_shop
    ENDIF
    ENDIF
    ENDIF



    Contoh Nested Selection/Non-Linear If Statement

    if Jns_kel = perempuan then
    if usia <25_tahun then
    add 1 to perempuan_muda
    if usia =>25_tahun
    add 1 to perempuan_dewasa
    endif
    else
    add 1 to laki-laki
    endif

    BalasHapus
  16. NURHAYATI
    MI 902
    NIM:091131105

    Maaf pak sebenarnya saya ga mengerti juga...
    1.simple selection
    IF nilai UAS > 100 THEN
    mata kuliah = computer security
    ELSE
    nilai UAS = active
    END IF
    2.Simple selection Tanpa Cabang
    IF nilai UAS = 100 THEN
    mata kuliah = computer security
    3.Combined Selection
    IF nilai UAS = 100 END kode = 1THEN
    mata kuliah = computer security
    ELSE
    nilai UAS = aktif
    END IF
    4.Linear Nested IF Statement
    IF perguruan tinggi = Universitas Indonesia THEN
    perguruan tinggi = 100
    ELSE
    IF perguruan tinggi = Universitas Andalas THEN
    perguruan tinggi = 65
    ELSE
    IF perguruan tinggi = Universitas Gajah Mada Then
    perguruan tinggi = 85
    ELSE
    perguruan tinggi = 0
    END IF
    END IF
    END IF
    5.Non Linear Nested IF Statement
    IF Mahasiswa_Nilai UAS>100 THEN
    IF Mahasiswa_Mahasiswa>1THEN
    nilai_rata-rata_ 10%
    ELSE
    nilai_rata-rata_ 5%
    ELSE
    END IF
    Nilai_rata-rata_ 0%
    END IF

    BalasHapus
  17. Nama: SUROSO
    NiM : 091131021
    MI_902


    1. SIMPLLE SELECTION

    IF Tanggal = “warna_merah” THEN
    Hari = “libur_kerja”
    ELSE
    Hari = “masuk_kerja”
    ENDIF



    2. SIMPLE SELECTION TANPA CABANG

    IF Tanggal = “warna_merah” THEN
    Hari = “libur_kerja”
    ENDIF



    3. COMBINED SELECTION

    IF Hari = “sabtu” AND Tanggal = {“warna_hitam” OR “warna_merah”} THEN
    Hari = “libur_kerja”
    ELSE
    Hari = “masuk_kerja”
    ENDIF



    4. NESTED SELECTION

    IF Hari = “senin” THEN
    Hari = “masuk_kerja”
    IF Hari = “selasa” THEN
    Hari = “masuk kerja”
    IF Hari = “rabu” THEN
    Hari = “masuk_kerja
    IF Hari = “kamis” THEN
    Hari = “masu_kerja”
    IF Hari = “jumat” THEN
    Hari = “masuk_kerja”
    ELSE
    Hari = “libur_keja”
    ENDIF
    ENDIF
    ENDIF
    ENDIF
    ENDIF

    5. NON – LINEAR IF STATEMENT

    IF Tanggal = “warna_merah” THEN
    IF Tanggal = “warna_hitam” THEN
    IF Hari = “sabtu” THEN
    ELSE
    Hari = “libur_kerja”
    ENDIF
    ELSE
    Hari = “masuk kerja”
    ENDIF
    ELSE
    Hari = “libur kerja”
    ENDIF

    BalasHapus
  18. *Simple Selection (simple IF Statement)
    answer :
    IF saldo < $600 THEN
    bunga = 0.6
    ELSE
    bunga = 0.2
    END IF

    *Simple Selection Tanpa Cabang
    answer :
    IF Saldo > $600 THEN
    bunga = saldo 0.2
    ENDIF

    *Combined selection
    answer :
    IF Jam kerja > 40 AND Kode = 01 THEN
    Gaji = Jam kerja * 27.000
    ELSE
    Gaji = Jam kerja * 25.000
    ENDIF

    *Nested Selection/Linear Nested If Statement
    answer :
    if Motor Cycle_colour='Red'THEN
    Increment counter_Red
    Else
    If bike_colour='Black'THEN
    Increment counter_Black
    Else
    If bike_colour='Blue'THEN
    Increment counter_Blue
    Else
    Increment error_counter
    ENDIF

    *Nested Selection/Non-Linear If Statement
    answer :
    If students_attendance=flag_ceremony THEN
    If students_gender=female THEN
    If students_age>12 THEN
    Add 1 to mature_fem_fc_students
    Else
    Add 1 to young _fem_fc_students
    ENDIF
    Else
    Add 1 to male_fc_students
    ENDIF
    Else
    Add 1 to full_time_students
    ENDIF

    BalasHapus
  19. nama :taufik ridwan
    kelas :902 MI malam
    NIM :091131024


    1. SIMPLLE SELECTION

    IF Tanggal = “warna_hitam” THEN
    Hari = “libur_kerja”
    ELSE
    Hari = “masuk_kerja”
    ENDIF



    2. SIMPLE SELECTION TANPA CABANG

    IF Tanggal = “warna_pink” THEN
    Hari = “libur_kerja”
    ENDIF



    3. COMBINED SELECTION

    IF Hari = “minggu” AND Tanggal = {“warna_hitam” OR “warna_merah”} THEN
    Hari = “libur_kerja”
    ELSE
    Hari = “masuk_kerja”
    ENDIF



    4. NESTED SELECTION

    IF Hari = “senin” THEN
    Hari = “masuk_kerja”
    IF Hari = “selasa” THEN
    Hari = “masuk kerja”
    IF Hari = “rabu” THEN
    Hari = “masuk_kerja
    IF Hari = “kamis” THEN
    Hari = “masu_kerja”
    IF Hari = “jumat” THEN
    Hari = “masuk_kerja”
    IF Hari = “saptu” THEN
    Hari = “masuk_kerja”
    ELSE
    Hari = “libur_keja”
    ENDIF
    ENDIF
    ENDIF
    ENDIF
    ENDIF
    ENDIF

    5. NON – LINEAR IF STATEMENT

    IF Tanggal = “warna_merah” THEN
    IF Tanggal = “warna_hitam” THEN
    IF Hari = “MINGGU” THEN
    ELSE
    Hari = “libur_kerja”
    ENDIF
    ELSE
    Hari = “masuk kerja”
    ENDIF
    ELSE
    Hari = “libur kerja”
    ENDIF

    BalasHapus
  20. nama :MAULANA YUSUF
    kelas :902 MI malam
    NIM :091130983




    1. SIMPLLE SELECTION

    Contoh:

    IF Barang= "Televisi" THEN
    Harga=Rp.1.000.000
    ELSE
    Harga=<"Rp.1.000.000
    ENDIF



    2.SIMPLE SELECTION TANPA CABANG

    Contoh:

    IF Barang= "Radio" THEN
    Harga = Rp.400.000


    3.COMBINED SELECTION

    Contoh:

    IF Barang = "VCD 20 %"
    ELSE
    Discount= "0 %"


    4.NESTED SELECTION

    Contoh:

    IF Barang= "Televisi" THEN
    Harga= "Rp.1000.000"
    ELSE
    IF Barang= "Radio" THEN
    Harga = "Rp.400.000"
    IF Barang= "VCD Player" THEN
    Harga = "Rp.400.000"
    ELSE
    Harga = "0"
    ENDIF
    ENDIF
    ENDIF


    5.NON-LINEAR IF STATEMENT

    Contoh:

    IF Barang = "Televisi" THEN
    IF Barang = "Radio" THEN
    IF Barang = "VCD Player0" THEN
    Discount = 20 %
    ELSE
    Discount = 0 %
    ENDIF
    ELSE
    Discount = 0 %
    ENDIF
    ELSE
    Discount = 0 %
    ENDIF

    BalasHapus
  21. 1. Contoh dari Simple selection(simple IF Statment):
    If Harga < RP.500.000 THEN
    Harga 1 + Harga 2 + harga 3 = Rp. 95.000 + Rp. 120.000 + Rp. 135.000
    Else
    Total Harga = Rp. 320.000
    ENDIF



    2. Contoh dari Simple Selection tanpa cabang :
    If Harga > Rp. 500.000 THEN
    Harga 1 + Harga 2 + Harga 3 = Total Harga*320.000
    ENDIF



    3. Contoh dari Combined Selection :
    If Harga < Rp. 100.000 OR kode = 3THEN
    Harga 1 + Harga 2 + Harga 3 = Total Harga*320000
    ELSE
    Harga 1 + Harga 2 +Harga 3= Total Harga*95000+120000+135000
    ENDIF



    4. Contoh dari Nested Selection/Linear Nested If Statement :
    If Shirt_colour='Blue'THEN
    Increment shop_Blue
    Else
    If Shirt_colour='Black'THEN
    Increment Shop_Black
    Else
    If Shirt_colour='Yellow'THEN
    Increment Shop_Yellow
    Else
    Increment error_shop
    ENDIF
    ENDIF
    ENDIF



    5. Contoh dari Nested Selection/Non-Linear If Statement :
    If students_attendance=flag_ceremony THEN
    If students_gender=female THEN
    If students_age>15 THEN
    Add 1 to mature_fem_fc_students
    Else
    Add 1 to young _fem_fc_students
    ENDIF
    Else
    Add 1 to male_fc_students
    ENDIF
    Else
    Add 1 to full_time_students
    ENDIF

    BalasHapus
  22. Rahmat
    902
    09113100


    1. SIMPLE SELECTION

    If 2+4 Then

    Hasil=6

    Else=8

    Endif


    2. Simple Selection Tanpa Cabang

    If 2+4 Then

    Hasil=8

    Endif

    3. Combined Selection

    maaf pak, Kurang Paham..


    4. Nested Selection

    maaf pak, Kurang Paham..


    5.Non-Linear Nested IF
    maaf pak, Kurang Paham..

    Tolong Contohnya diJelasin yang seditail mungkin Pak.

    BalasHapus
  23. nurfajriyah_902
    MI_091130013

    1. Contoh dari Simple selection(simple IF Statment):
    IF harga harga handphone < Rp. 800.000 THEN
    discount = 5%
    ELSE
    discount = 10%
    ENDIF

    2. Contoh dari Simple Selection tanpa cabang

    IF jumlah harga handphone > Rp. 800.000 THEN
    discount = j.harga belanja*10%
    ENDIF

    3. contoh COMBINED SELECTION

    IF Handphone = “nokia” AND "samsung" = {“warna_hitam” OR “warna_merah”} THEN
    handphone = “sms_tlp”
    ELSE
    handphone = “tlp_sms”
    ENDIF

    4. Contoh dari Nested Selection/Linear Nested If Statement :

    IF hp_nokia 1600='black'THEN
    Increment boutique_black
    ELSE
    IF hp nokia n73_colour='red'THEN
    Increment boutique_red
    ElSE
    IF hp_nokia E63='white'THEN
    Increment boutique_white
    ELSE
    Increment error_boutique
    ENDIF
    ENDIF
    ENDIF

    6. contoh Non Linear Nested IF Statement

    IF hp_nokia 1600>100 THEN
    IF hp_nokia E63>1THEN
    harga_rata-rata_ 10%
    ELSE
    harga_rata-rata_ 5%
    ELSE
    END IF
    harga_rata-rata_ 0%
    END IF

    BalasHapus
  24. ahmad kadiman
    mi_902
    1.SIMPLLE SELECTION
    lf tanggal="warna"_biru"THEN
    HARI ="OF _kerja
    Else
    hari ="IN_Kerja
    Endif


    2.Simple selection tanpa cabang
    lf tanggal ="warna_Black"Then
    Hari="of_kerja
    Endif


    3.COMBINED SELECTION
    lf hari=" kamis" And tanggal ("warna _biru"or"
    warna_putih ")Then
    Hari ="of"_kerja
    ELSE
    Hari="in"_kerja
    ENDIF


    4.NEDSTED SELECTION
    lf Hari='senin"Then
    Hari="in"_kerja
    lf Hari ="selasa"Then
    Hari ="in"_kerja
    lf Hari ="rabu"Then
    Hari ="in"_kerja
    lf Hari ="kamis"Then
    Hari ="in"_kerja
    lf Hari ="jumat"Then
    Hari ="in"_kerja
    Else
    Hari="of_kerja
    Endif


    5.NON_linear lf statement
    lf tanggal ="warna_jingga"Then
    lf tanggal ="warna_hijau"Then
    lf Hari ="sabtu"Then
    Else
    Hari ="of_kerja
    Endif
    Else
    Hari="in kerja"

    BalasHapus
  25. melvaria_902
    MI_091131099
    1.Contoh simple selection
    If Ukuran <400 cm THEN
    Panjang x Lebar =10 X 30
    Else
    Panjang x Lebar = 300
    ENDIF

    2.Contoh dari Simple Selection tanpa cabang
    If Ukuran > 400cm THEN
    Panjang x Lebar = ukuran*300
    ENDIF

    3.Contoh dari Combined Selection
    If Ukuran < 400cm OR kode = 3THEN
    Panjang x Lebar = Ukuran*300
    ELSE
    Panjang x Lebar = Ukuran*10 x 30
    ENDIF

    4.Contoh Nested Selection
    IF record_code=‘P’ THEN
    increment counter_P
    ELSE
    IF record_code=‘Q’ THEN
    increment counter_Q
    ELSE
    IF record_code=‘R’ THEN
    increment counter_R
    ELSE
    increment error_counter
    ENDIF
    ENDIF
    ENDIF
    5.Contoh Non linear nested If statemant
    maaf pak saya kurang paham
    mohon di perbaiki jika ada kesalahan

    BalasHapus
  26. Nurhasanah {902}
    _091131035_

    1) Contoh dari Simple selection(simple IF Statment):

    If Ukuran < 60cm THEN
    Panjang X Lebar = 9 X 5
    Else
    Panjang X Lebar = 45
    ENDIF




    2) Contoh dari Simple Selection tanpa cabang

    If Ukuran > 60cm THEN
    Panjang X Lebar = ukuran*45
    ENDIF





    3) Contoh dari Combined Selection :

    If Ukuran < 60cm OR kode = 2THEN
    Panjang X Lebar = Ukuran*45
    ELSE
    Panjang X Lebar = Ukuran*9 X 5
    ENDIF




    4) Contoh dari Nested Selection/Linear Nested If Statement :

    If bike_colour='Grey'THEN
    Increment counter_Grey
    Else
    If bike_colour='Black'THEN
    Increment counter_Black
    Else
    If bike_colour='Orange'THEN
    Increment counter_orange
    Else
    Increment error_counter
    ENDIF
    ENDIF
    ENDIF



    5) Contoh dari Nested Selection/Non-Linear If Statement :

    If Teachers_attendance=meeting THEN
    If teachers_gender=male THEN
    If teacher_age>45 THEN
    Add 1 to mature_mal_meet_teachers
    Else
    Add 1 to young _mal_meet_teachers
    ENDIF
    Else
    Add 1 to female_meet_teachers
    ENDIF
    Else
    Add 1 to full_time_teachers
    ENDIF
    8 Maret 2011 10:38

    BalasHapus