Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Php tugas1 #5

Open
wants to merge 4 commits into
base: js_tugas6
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 0 additions & 36 deletions kalkulator.html

This file was deleted.

47 changes: 0 additions & 47 deletions kurs.js

This file was deleted.

54 changes: 54 additions & 0 deletions tugas1_php_1A_Yozi_Berlianda_STT NF.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?php
$namaPegawai = 'Ahmad Sopandi';
$agama = 'Islam';
$jabatan = 'Manager';
$status = 'Menikah';
$jmlAnak = 4;
$gaji;
$tunjab;
$tunkel;
$zakat_profesi;
$gator;
$gaber;

switch ($jabatan) {
case "Manager":
$gaji = 20000000;
break;
case "Asisten Manager":
$gaji = 15000000;
break;
case "Kabag":
$gaji = 10000000;
break;
case "Staff":
$gaji = 4000000;
break;
default:
$gaji = 0;
}
$tunjab = 0.2 * $gaji;

if ($status == 'Menikah' && $jmlAnak <= 2) $tunkel = 0.05 * $gaji;
else if ($status == 'Menikah' && $jmlAnak >= 3 && $jmlAnak <= 5) $tunkel = 0.1 * $gaji;
else $tunkel = 0;

$gator = $gaji + $tunjab + $tunkel;
$zakat_profesi = ($agama == "Islam" && $gator >= 6000000) ? $zakat_profesi = 0.025 * $gator : 0;

$take_home_pay = $gator - $zakat_profesi;

?>
<hr />
Nama : <?= $namaPegawai ?>
<br /> Agama : <?= $agama ?>
<br /> Jabatan : <?= $jabatan ?>
<br /> Status : <?= $status ?>
<br /> Jumlah Anak : <?= $jmlAnak ?>
<br /> Gaji : Rp <?= number_format($gaji, 0, "", ".") ?>
<br /> Tunjangan Jabatan : Rp <?= number_format($tunjab, 0, "", ".") ?>
<br /> Tunjangan Keluarga : Rp <?= number_format($tunkel, 0, "", ".") ?>
<br /> Gaji Kotor : Rp <?= number_format($gator, 0, "", ".") ?>
<br /> Zakat Profesi : Rp <?= number_format($zakat_profesi, 0, "", ".") ?>
<br /> Take Home Pay : Rp <?= number_format($take_home_pay, 0, "", ".") ?>
<hr />
93 changes: 93 additions & 0 deletions tugas2A_php_1A_Yozi_Berlianda_STTNF.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<!doctype html>
<html lang="en">

<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">

<title>Form Nilai</title>
</head>

<body>
<div class="container bg-light">
<div class="text-center">
<h6 class="text-primary pt-4 mt-4">Form Nilai</h6>
<h1 class="mb-5">Form Nilai</h1>
</div>
<form method="POST" action="tugas2A_php_1A_Yozi_Berlianda_STTNF.php">
<div class="mb-3">
<label for="exampleFormControlInput1" class="form-label">Nama</label>
<input type="text" class="form-control" name="nama" id="exampleFormControlInput1" placeholder="Nama">
</div>
<div class="mb-3">
<label for="exampleFormControlInput1" class="form-label">Mata Pelajaran</label>
<select class="form-select" aria-label="Default select example" name="matpel">
<option selected>Pilih Mata Pelajaran</option>
<option value="IPA">IPA</option>
<option value="IPS">IPS</option>
<option value="Matematika">Matematika</option>
<option value="Fisika">Fisika</option>
</select>
</div>
<div class="mb-3">
<label for="exampleFormControlInput1" class="form-label">Nilai</label>
<input type="number" class="form-control" name="nilai" id="exampleFormControlInput1" placeholder="Nilai">
</div>
<div class="mb-3">
<input name="simpan" type="submit" class="btn btn-primary" value="Simpan" />
</div>
<br />
</form>
</div>
<?php
$nama = $_POST['nama'];
$matpel = $_POST['matpel'];
$nilai = $_POST['nilai'];
$simpan = $_POST['simpan'];

$kelulusan = ($nilai >= 60) ? 'Lulus' : 'Tidak Lulus';

if ($nilai >= 85 && $nilai <= 100) $grade = "A";
else if ($nilai >= 75 && $nilai < 85) $grade = "B";
else if ($nilai >= 60 && $nilai < 75) $grade = "C";
else if ($nilai >= 30 && $nilai < 60) $grade = "D";
else if ($nilai >= 0 && $nilai < 30) $grade = "E";

switch ($grade) {
case "A":
$predikat = "Memuaskan";
break;
case "B":
$predikat = "Baik";
break;
case "C":
$predikat = "Cukup";
break;
case "D":
$predikat = "Kurang";
break;
case "E":
$predikat = "Buruk";
break;
default:
$predikat = "-";
}
if (!empty($simpan)) {
?>
<div class="container">
<div class="alert alert-success" role="alert">
Nama : <?= $nama ?>
<br />Mata Pelajaran : <?= $matpel ?>
<br />Nilai : <?= $nilai ?>
<br />Keterangan : <?= $kelulusan ?>
<br />Grade: <?= $grade ?>
<br />Predikat : <?= $predikat ?>
</div>
</div>
<?php } ?>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>

</body>

</html>
85 changes: 85 additions & 0 deletions tugas2B_php_1A_Yozi Berlianda_STTNF.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<!doctype html>
<html lang="en">

<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">

<title>Form Data Diri</title>
</head>

<body>
-->
<div class="container bg-light">
<div class="text-center">
<h6 class="text-primary pt-4 mt-4">Form Data Diri</h6>
<h1 class="mb-5">Form Data Diri</h1>
</div>
<form method="POST" action="tugas2B_php_1A_Yozi_Berlianda_STTNF.php">
<div class="mb-3">
<label for="exampleFormControlInput1" class="form-label">Nama</label>
<input type="text" class="form-control" name="nama" id="exampleFormControlInput1" placeholder="Nama">
</div>
<div class="mb-3">
<label for="exampleFormControlInput1" class="form-label">Pekerjaan</label>
<select class="form-select" aria-label="Default select example" name="pekerjaan">
<option selected>Pilih Pekerjaan</option>
<?php
$nama = $_POST['nama'];
$pekerjaan = $_POST['pekerjaan'];
$hobby = $_POST['hobby'];
$simpan = $_POST['simpan'];

for ($i = 1; $i <= 10; $i++) { ?>
<option value="pekerjaan<?= $i ?>">pekerjaan <?= $i ?> </option>
<?php } ?>
</select>
</div>
<div class="mb-3">
<label for="exampleFormControlInput1" class="form-label">Hobby</label>
<?php
$a = 1;
while ($a <= 10) { ?>
<div class="form-check">
<input class="form-check-input" type="radio" name="hobby" id="flexRadioDefault1" value="hobby<?= $a ?>">
<label class="form-check-label" for="flexRadioDefault1">
hobby<?= $a ?>
</label>
</div>
<?php $a++;
} ?>
</div>
<div class="mb-3">
<input name="simpan" type="submit" class="btn btn-primary" value="Simpan" />
</div>
</form>
</div>
<?php if (!empty($simpan)) { ?>
<div class="container">
<div class="alert alert-success" role="alert">
<table class="table">
<thead>
<tr>
<th scope="col">Nama</th>
<th scope="col">Pekerjaan</th>
<th scope="col">Hobby</th>
</tr>
</thead>
<tbody>

<tr>
<td><?= $nama ?></td>
<td><?= $pekerjaan ?></td>
<td><?= $hobby ?></td>
</tr>
</tbody>
</table>
</div>
</div>
<?php } ?>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>

</body>

</html>
Loading