Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>Statement SWITCH</title>
- </head>
- <body>
- <center><h1>Tugas 3</h1></center>
- <form method="get"action="">
- Jumlah jam kerja selama satu minggu:
- <input type="text" name="jam"><br>
- <input type="submit" name="submit" value="submit">
- <input type="reset" name="reset" value="reset"><br>
- <?php
- $jam=$_GET[jam];
- $upah1=2000;
- $upah2=3000;
- $gaji1=$jam*$upah1;
- $lembur=($jam-48)*$upah2;
- $gaji2=(48*$upah1)+$lembur;
- echo "Jumlah jam kerja selama satu minggu adalah ".$_GET[jam]. " jam/minggu <br>";
- switch($jam)
- {
- case $jam <= 48 : echo "Gaji = Rp. ".$gaji1."<br>";
- break;
- case $jam > 48 : echo "Gaji = Rp. ".$gaji2."<br>";
- break;
- default : "Anda belum memasukan jumlah jam kerja selama satu minggu";
- }
- ?>
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement