Welcome to my Blog.... [~___~]

TUGAS MODUL 6

Senin, 02 Juni 2014
TUGAS
1. Buatlah Program menggunakan Array 1 dimensi untuk mengakses data-data
mahasiswa.
Penyelesaian :
<html>
    <head>
        <title>Modul 6 | Praktik 3</title>
        <link  href='/style.css' rel='stylesheet' type='text/css'/>
        <script  src='/script.js' type='text/javascript'></script>
    </head>
    <body onLoad="document.body.style.backgroundColor=bg">
        <div id="judul">Data Mahasiswa</div>
        <div id="isi">
            <?php
                $nim = Array

("13MI0001","13MI0002","13MI0003","13MI0004","13MI0005","13MI0006","13MI0007","13MI0008","13MI0010","13MI0011","13MI0012","13MI0013","13MI0014","13MI0015","13M

I0016","13MI0017","13MI0018","13MI0019","13MI0020","13MI0021","13MI0023","13MI0024","13MI0025","13MI0026","13MI0027","13MI0028",);
                $nama = Array("Adi Nurcahyo","Ahmad Amirudin","Ahmad Shoerudin","Anang Sulistyo Fadli","Bayu Aditya","Defi Dyah

Anggraeni","Destantia Permatasari","Fitriyani","Imam Ihsan Permana","Inarotul Ainiyah","Insanatun Fadillah","Laila Kurniati Rahma","Luvi Ikhtiyarini",

"Ninik Fitriani","Nurhalimah","Nuri Hadiningsih","Oki Satria Setiawan","Rizki Arie Putra","Samsul Ma'arif","Sari Setianingtyas","Siti Khadikotun

Sururiah","Solikhatun","Supriyani","Tita Isrofi","Titis Rachmatika","Arif Rahman");
                print ("<table width=49% align=center border=1 cellspacing=0 style=float:left;><tr><th>NIM</th><th>Nama</th></tr>");
                for ($data = 0; $data <= 12; $data++) {
                    print("<tr><td>$nim[$data]</td><td>$nama[$data]</td></tr>");
                }
                print ("</table>");
                print ("<table width=49% align=center border=1 cellspacing=0 style=float:right;><tr><th>NIM</th><th>Nama</th></tr>");
                for ($data = 13; $data <= 25; $data++) {
                    print("<tr><td>$nim[$data]</td><td>$nama[$data]</td></tr>");
                }
                print ("</table>");
            ?>
        </div>
    </body>
</html>





 Hasilnya :


2. Buatlah program menggunakan Array multidimensi dalam transaksi pembelian
barang.
Penyelesaian :
<html>
    <head>
        <title>Modul 6 | Praktik 4</title>
        <link  href='/style.css' rel='stylesheet' type='text/css'/>
        <script  src='/script.js' type='text/javascript'></script>
    </head>
    <body onload="document.body.style.backgroundColor=bg">
        <div id="judul">Transaksi Penjualan Barang</div>
        <div id="isi">
            <div style="width:32%;margin:0 auto;">
                <?php
                    $perlengkapan = Array("sabunmandi"=>Array("Gift","Harmoni","Lifeboy","Nuvo"),"sampo"=>Array("Sunsilk","Clear","Pantene","Lifeboy Shampo"),"deterjen"=>Array("Daia","Rinso","Soklin","Boom","B-39","Bunga"),"pewangi"=>Array("Downy","Soklin Pewangi"),"sabuncuci"=>Array("Sunlight"));
                    $peralatan = Array("alatdapur"=>Array("Kompor","Panci","Kwali","Oven"),"alatmakan"=>Array("Sendok","Garpu","Piring","Mangkok","Gelas"),"alatkebersihan"=>Array("Sapu","Kain Lap","Tempat Sampah"),"alatkebun"=>Array("Cangkul","Sekop"));
                    print("Daftar Belanja:<ol style=margin:0 auto;><li>Perlengkapan<ul><li>".$perlengkapan['sabunmandi'][2]."<span style=float:right;>(5)</span></li><li>".$perlengkapan['sampo'][0]."<span style=float:right;>(2)</span></li><li>".$perlengkapan['sampo'][2]."<span style=float:right;>(2)</span></li><li>".$perlengkapan['deterjen'][2]."<span style=float:right;>(3)</span></li><li>".$perlengkapan['pewangi'][0]."<span style=float:right;>(6)</span></li><li>".$perlengkapan['sabuncuci'][0]."<span style=float:right;>(5)</span></li></ul></li><li>Peralatan<ul><li>".$peralatan['alatdapur'][0]."<span style=float:right;>(1)</span></li><li>".$peralatan['alatdapur'][3]."<span style=float:right;>(1)</span></li><li>".$peralatan['alatmakan'][0]."<span style=float:right;>(36)</span></li><li>".$peralatan['alatmakan'][2]."<span style=float:right;>(12)</span></li><li>".$peralatan['alatkebersihan'][1]."<span style=float:right;>(2)</span></li><li>".$peralatan['alatkebun'][1]."<span style=float:right;>(1)</span></li></ul></li></ol>");
                ?>
            </div>
        </div>
    </body>
</html>



 Hasilnya :

















0 komentar:

Posting Komentar