Latest Movies :
Home » » UTS (ULANGAN TENGAH SEMESTER 08-05-14 )

UTS (ULANGAN TENGAH SEMESTER 08-05-14 )

                                 UJIAN TENGAH SEMESTER 
                              TAHUN PEMBELAJARAN 2003/2004
                        PRAKTIKUM PEMROGRAMAN TERSTRUKTUR

1. Program menggunakan funcion variabel

<html>
<head></head>
<title>Soal Ujian Tengah Semester Pemrograman Terstruktur</title>
<body>
<p align = "center">
 <strong>HARGA BARANG</strong>
<?
$kd1 = "B001";//variabel global
$kd2 = "B002";//variabel global
$kd3 = "B003";//variabel global
$kd4 = "B004";//variabel global
$nb1 = "Buku Tulis";//variabel global
$nb2 = "Buku Gambar";//variabel global
$nb3 = "Penggaris";//variabel global
$nb4 = "Penghapus";//variabel global
$jml1 = "2";//variabel global
$jml2 = "2";//variabel global
$jml3 = "1";//variabel global
$jml4 = "2";//variabel global
$hrg1 = "5000";//variabel global
$hrg2 = "8000";//variabel global
$hrg3 = "2500";//variabel global
$hrg4 = "1500";//variabel global
function varglobal()
{
global $kd1,$kd2,$kd3,$kd4,$nb1,$nb2,$nb3,$nb4,$jml1,$jml2,$jml3,$jml4,
$hrg1,$hrg2,$hrg3,$hrg4;
}
varglobal();//fungsi pemanggilan


function varlokal()
{
global $kd1,$kd2,$kd3,$kd4,$nb1,$nb2,$nb3,$nb4,$jml1,$jml2,$jml3,$jml4,
$hrg1,$hrg2,$hrg3,$hrg4,$jmlhrg1,$jmlhrg2,$jmlhrg3,$jmlhrg4,$tothrg;
$jmlhrg1 = $jml1*$hrg1;
$jmlhrg2 = $jml2*$hrg2;
$jmlhrg3 = $jml3*$hrg3;
$jmlhrg4 = $jml4*$hrg4;
$tothrg = ($jmlhrg1+$jmlhrg2+$jmlhrg3+$jmlhrg4);
}
varlokal();//fungsi pemanggilan

echo "<table border=1px>
<tr>
  <td colspan=5 align=center><strong>PEMROGRAMAN TERSTRUKTUR</strong></td>
</tr><tr>
<td><strong>Kode Barang</strong> </td>
<td><strong>Nama Barang </strong></td>
<td><strong>Jumlah</strong></td>
<td><strong>Harga</strong></td>
<td><strong>Jumlah Harga</strong> </td>
</tr><tr><td>$kd1</td>
  <td>$nb1</td>
  <td>$jml1</td>
  <td>Rp. $hrg1</td>
  <td>Rp. $jmlhrg1</td>
</tr><tr><td>$kd2</td>
  <td>$nb2</td>
  <td>$jml2</td>
  <td>Rp. $hrg2</td>
  <td>Rp. $jmlhrg2</td>
  </tr><tr><td>$kd3</td>
  <td>$nb3</td>
  <td>$jml3</td>
  <td>Rp. $hrg3</td>
  <td>Rp. $jmlhrg3</td>
  </tr><tr><td>$kd4</td>
  <td>$nb4</td>
  <td>$jml4</td>
  <td>Rp. $hrg4</td>
  <td>Rp. $jmlhrg4</td>
</tr>

<tr><td colspan=4><p align =right><strong>Total Harga</strong></p></td>
  <td><strong>Rp. $tothrg</strong></td>
</tr></table>
"
?>
</p>
</body>
</html>

HASIL CODING :


2.

<html>
<head>
<title>Praktek Pemrograman Testruktur</title>
</head>
<div><strong>Menghitung Gaji Pegawai</strong></div>
<br />
<form action="" method="post">
Masukan Data Jabatan
<br>
<input type="text" name="jabatan">
<br><br>
<input type="submit" name="hasil" value="Hasil">
<br>
<br />
<?
if(isset($_POST['hasil'])) {
$jabatan = $_POST['jabatan'];
$gajipokok= 2500000;
$bonus = 500000;
$pajak = ($gajipokok * 10)/100;
switch ($jabatan)
{
case Direktur: $tunjangan1 = 10000000;
$gajibersih= ($gajipokok+$bonus+$tunjangan1)-$pajak;
break;
case Manajer:$tunjangan1 = 5000000;
$gajibersih= ($gajipokok+$bonus+$tunjangan1)-$pajak;

break;
case EDP: $tunjangan1 = 4500000;
$gajibersih= ($gajipokok+$bonus+$tunjangan1)-$pajak;

break;
default: $tunjangan1 = 3000000;
$gajibersih= ($gajipokok+$bonus+$tunjangan1)-$pajak;

}
echo "
<table>
<tr>
<td colspan=3>========================================</td>
</tr>
<tr>
<td>NIP</td><td>=</td><td>13.MI.0018</td>
</tr>
<tr>
<td>Nama Pegawai</td><td>=</td><td>OKI SATRIA SETIAWAN</td>
</tr>
<tr>
<td colspan=3>========================================</td>
</tr>
<tr>
<td>Gaji Pokok</td><td>=</td><td>Rp. $gajipokok</td>
</tr>
<tr>
<td>Bonus</td><td>=</td><td>Rp. $bonus</td>
</tr>
<tr>
<td>Tunjangan</td><td>=</td><td>Rp. $tunjangan1</td>
</tr>
<tr>
<td>Pajak</td><td>=</td><td>Rp. $pajak</td>
</tr>
<tr>
<td colspan=3>========================================</td>
</tr>
<tr>
<td>Gaji Yang Harus Dibayar </td><td>=</td><td> Rp. $gajibersih</td>
</tr>
</table>
";
}
?>
</form>
</html>

HASIL CODING :


Share this article :

+ komentar + 1 comment

8 Mei 2014 pukul 19.48

like

Posting Komentar

 
Support : AMIK PGRI KEBUMEN | OKI SATRIA SETIAWAN
Copyright © 2014. O-kiss - All Rights Reserved
Template Modify by Creating Website
Proudly powered by Blogger