Rabu, 25 April 2012

Kasus I (Tugas Web I)

Daftar Buku Pinjaman Nina pada Perpustakaan STIMED Nusa Palapa
Nina adalah seorang member pada perpustakaan STIMED Nusa Palapa dengan identitas sebagai berikut :
Kode member : P12005
Alamat            : Jln. P. Kemerdekaan
No. Telpon     : 085342982343

Nina meminjam buku yaitu Buku novel Ayat-ayat cinta, ketika cinta bertasbih dan buku komputer yaitu Mahir Pemrograman PHP, serta Jaringan komputer. Biaya sewa tiap jenis buku berbeda, yakni untuk Buku Novel tarif sewa per buku yaitu Rp.3000 dan buku komputer Rp.6000. Nina meminjam selama 3 hari, namun karena suatu alasan nina terlambat mengembalikan buku itu selama 2 hari dengan denda Rp.2000 per hari untuk tiap buku. Nina mendapat potongan denda sebesar Rp.10000 karena dia adalah member lama.

Buatlah dalam HTML untuk menampilkan daftar buku pinjaman nina serta total yang harus dibayar . Simpan filenya dengan nama Tugas1.php

<?php
       //identitas peminjam
       $nm_member = "Nina";
       $kd_member = "P12005";
       $alamat = "Jl.P.Kemerdekaan";
       $no_tel = "085342982343";
      
       //judul buku
       $jdl_bk1 = "Ayat-ayat cinta";
       $jdl_bk2 = "Ketika Cinta Bertasbih";
       $jdl_bk3 = "Mahir Pemrograman PHP";
       $jdl_bk4 = "Jaringan Komputer";
      
       //kode buku
       $kd_bk1 = "N001";
       $kd_bk2 = "N002";
       $kd_bk3 = "K001";
       $kd_bk4 = "K001";
      
       $biaya_pnjm_bnovel= 3000; //untuk jenis novel
       $biaya_pnjm_bkom= 6000; // untuk jenis buku kompoter
       $denda = 2000; // denda per hari untuk satu buku
       $lwt_bts = 2;
       $jml_bk = 4;
       $lama_pnjm = 3;
       $pot_denda = 10000;
      
       //bayar tiap buku
       $tot_bk1 = $biaya_pnjm_bnovel*1;
       $tot_bk2 = $biaya_pnjm_bnovel*1;
       $tot_bk3 = $biaya_pnjm_bkom*1;
       $tot_bk4 = $biaya_pnjm_bkom*1;
      
       //hitung total bayar buku
       $total_bk = $tot_bk1+$tot_bk2+$tot_bk3+$tot_bk4;
      
       //hitung total dengan denda
       $total_denda = $denda*$jml_bk*$lwt_bts;
      
       //hitung seluruhnya
       $total_bayar = ($total_bk+$total_denda)-$pot-denda;
?>

<html>
<head>
<title>Perpustakaan STIMED-NP</title>
<style type="text/css">
<!--
.style1 {
       font-size: 24px;
       font-weight: bold;
}
.style3 {color: #FFFFFF}
.style4 {font-size: 10px}
-->
</style>
</head>

<body>
<table width="200" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#000000">
  <tr>
    <td><table width="459" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td height="53" colspan="2" bgcolor="#0099FF"><div align="center" class="style1">
          <p align="center"><img src="Stimed-Nusa-Palapa-Logo.png" width="110" height="83"></p>
                 </div></td>
        <td height="53" bgcolor="#0099FF"><div align="center" class="style1">Perpustakaan STIMED NUSA PALAPA</div></td>
        </tr>
      <tr>
        <td colspan="3" bgcolor="#0099FF">
          <table width="572" height="22" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#000000">
            <tr>
              <td width="565"><span class="style3">
                <marquee behavior="alternate">Jln. Urip Sumoharjo No. 20 Graha Pena Lantai 10 Makasar </marquee> </span></td>
            </tr>
          </table>       </td>
      </tr>
      <tr>
        <td colspan="3"></td>
      </tr>
      <tr>
        <td width="105">Kode Member </td>
        <td width="10">:</td>
        <td width="457"><div align="left"><?php echo $kd_member; ?></div></td>
      </tr>
      <tr>
        <td>Nama</td>
        <td>:</td>
        <td><div align="left"><?php echo $nm_member; ?></div></td>
      </tr>
      <tr>
        <td>Alamat</td>
        <td>:</td>
        <td><div align="left"><?php echo $alamat; ?></div></td>
      </tr>
      <tr>
        <td>No. Telpon </td>
        <td>:</td>
        <td><div align="left"><?php echo $no_tel; ?></div></td>
      </tr>
      <tr>
        <td colspan="3"></td>
      </tr>
      <tr>
        <td colspan="3"><table width="571" height="171" border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td width="101" bgcolor="#0099FF"><div align="center">Kode Buku </div></td>
              <td width="4" rowspan="5" bgcolor="#000000"></td>
              <td width="173" bgcolor="#0099FF"><div align="center">Judul Buku </div></td>
              <td width="4" rowspan="5" bgcolor="#000000"></td>
              <td width="130" bgcolor="#0099FF"><div align="center">Lama Sewa (hari) </div></td>
              <td width="5" bgcolor="#000000"></td>
              <td width="154" bgcolor="#0099FF"><div align="center">Harga Sewa (Rp)</div></td>
              </tr>
            <tr>
              <td bgcolor="#CCCCFF"><div align="center"><?php echo $kd_bk1; ?></div></td>
              <td bgcolor="#CCCCFF"><div align="center"><?php echo $jdl_bk1; ?></div></td>
              <td bgcolor="#CCCCFF"><div align="center"><?php echo $lama_pnjm ; ?></div></td>
              <td bgcolor="#000000"></td>
              <td bgcolor="#CCCCFF"><div align="center"><?php echo $tot_bk1; ?></div></td>
              </tr>
            <tr>
              <td bgcolor="#CCCCFF"><div align="center"><?php echo $kd_bk2; ?></div></td>
              <td bgcolor="#CCCCFF"><div align="center"><?php echo $jdl_bk2; ?></div></td>
              <td bgcolor="#CCCCFF"><div align="center"><?php echo $lama_pnjm ; ?></div></td>
              <td bgcolor="#000000"></td>
              <td bgcolor="#CCCCFF"><div align="center"><?php echo $tot_bk2; ?></div></td>
              </tr>
            <tr>
              <td bgcolor="#CCCCFF"><div align="center"><?php echo $kd_bk3; ?></div></td>
              <td bgcolor="#CCCCFF"><div align="center"><?php echo $jdl_bk3; ?></div></td>
              <td bgcolor="#CCCCFF"><div align="center"><?php echo $lama_pnjm ; ?></div></td>
              <td bgcolor="#000000"></td>
              <td bgcolor="#CCCCFF"><div align="center"><?php echo $tot_bk3; ?></div></td>
              </tr>
            <tr>
              <td bgcolor="#CCCCFF"><div align="center"><?php echo $kd_bk4; ?></div></td>
              <td bgcolor="#CCCCFF"><div align="center"><?php echo $jdl_bk4; ?></div></td>
              <td bgcolor="#CCCCFF"><div align="center"><?php echo $lama_pnjm ; ?></div></td>
              <td bgcolor="#000000"></td>
              <td bgcolor="#CCCCFF"><div align="center"><?php echo $tot_bk4; ?></div></td>
              </tr>
            <tr>
              <td colspan="3"><div align="right"></div></td>
              <td></td>
              <td><div align="right">Total</div></td>
              <td>:</td>
              <td><div align="center"><?php echo $total_bk; ?></div></td>
              </tr>
            <tr>
              <td colspan="3"><div align="left">Jumlah Buku = <?php echo $jml_bk;?> buku </div></td>
              <td></td>
              <td><div align="right">Denda</div></td>
              <td>:</td>
              <td><div align="center"><?php echo $total_denda; ?></div></td>
              </tr>
            <tr>
              <td colspan="3"><div align="left">Lewat Batas Pinjam = <?php echo $lwt_bts; ?> Hari</div></td>
              <td></td>
              <td><div align="right">Potongan Denda</div></td>
              <td>:</td>
              <td><div align="center"><?php echo $pot_denda; ?></div></td>
              </tr>
            <tr>
              <td colspan="7"></td>
            </tr>
            <tr>
              <td colspan="3"><div align="left" class="style4">*Denda per hari untuk setiap buku yaitu Rp.2000 </div></td>
              <td></td>
              <td><div align="right">Total Bayar</div></td>
              <td>:</td>
              <td><div align="center"><?php echo $total_bayar; ?></div></td>
              </tr>
            <tr>
              <td colspan="7"><div align="right">
              </div></td>
              </tr>
        </table></td>
      </tr>
      <tr>
        <td colspan="3" bgcolor="#0099FF"><div align="center">Copyright@Nurul Ilmah-2012</div></td>
      </tr>
    </table></td>
  </tr>
</table>
<p align="center"></p>
</body>
</html>

dari listing diatas akan menampilkan sebagai berikut :

0 komentar:

Posting Komentar

Silahkan Beri Komentar... ^^