0% found this document useful (0 votes)
39 views

Pertemuan 1: Output

The document contains code for a PHP web programming assignment. It includes: 1) Display of student data and a grade calculation using PHP variables and conditional statements. 2) Functions to convert decimal numbers to binary, octal, and hexadecimal representations. 3) Forms and functions to convert between Celsius, Fahrenheit, Kelvin, and Reaumur temperature scales using PHP variables and conditional statements.

Uploaded by

Sugeng Mulyadi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views

Pertemuan 1: Output

The document contains code for a PHP web programming assignment. It includes: 1) Display of student data and a grade calculation using PHP variables and conditional statements. 2) Functions to convert decimal numbers to binary, octal, and hexadecimal representations. 3) Forms and functions to convert between Celsius, Fahrenheit, Kelvin, and Reaumur temperature scales using PHP variables and conditional statements.

Uploaded by

Sugeng Mulyadi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Mata Kuliah : Pemgraman Web Lanjut – TI – S1

Nama : Briliantino Abhista Prabandanu

NIM : A11.2018.11590

Kelompok : A11.4401U

PERTEMUAN 1

Output :

Coding :
<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<meta http-equiv="X-UA-Compatible" content="ie=edge">

<title>Document</title>

</head>

<body>

<?php

echo "<table>";

echo "<h4>SOAL A<br></h4>";

echo "<tr> <td>NIM</td> <td>: A11.2018.11590</td> </tr>";

echo "<tr> <td>Nama</td> <td>: Briliantino A.P</td> </tr>";

echo "<tr> <td>Alamat</td> <td>: Salatiga</td> </tr>";

echo "<tr> <td>No. Telp </td></td> <td>: 089696873420</td> </tr>";

echo "<tr> <td>E-Mail</td></td> <td>: [email protected]</td> </tr>";

echo "</table><br>";

echo "<h4>SOAL B <br></h4>";

$uts=70;

$uas=80;

$tgs=90;

$prosenuts = (0.2*$uts);

$prosenuas = (0.35*$uas);

$prosentgs = (0.45*$tgs);

$hasil= ($prosenuts+$prosentgs+$prosenuas);

if($hasil >=85 && $hasil<=100)

{
$hasilhrf = "A";

else if($hasil >=68.5 && $hasil<=83.4)

$hasilhrf = "B";

else if($hasil >=58.5 && $hasil<=68.4)

$hasilhrf = "C";

else if($hasil >=40 && $hasil<=58.4)

$hasilhrf = "D";

else

$hasilhrf = "E";

echo "<table>";

echo "<tr> <td>NIM</td> <td>: A11.2018.11590</td> </tr>";

echo "<tr> <td>Nama</td> <td>: Briliantino A.P</td> </tr>";

echo "<tr> <td>Tgs</td> <td>: $tgs</td> </tr>";

echo "<tr> <td>UTS</td> <td>: $uts</td> </tr>";

echo "<tr> <td>UAS</td> <td>: $uas</td> </tr>";

echo "<tr> <td>Nilai</td> <td>: $hasil</td> </tr>";

echo "<tr> <td>Nilai.H</td> <td>: $hasilhrf</td> </tr>";

echo "</table>";

$biner = "0";
$oktal = "0";

$hexa = "0";

$celcius = 0;

$celcius2 = 0;

$celcius3 = 0;

$celcius4 = 0;

$fahrenheit = 0;

$fahrenheit2 = 0;

$fahrenheit3 = 0;

$fahrenheit4 = 0;

$kelvin = 0;

$kelvin2 = 0;

$kelvin3 = 0;

$kelvin4 = 0;

$reamur = 0;

$reamur2 = 0;

$reamur3 = 0;

$reamur4 = 0;

$input = 0;

if(isset($_POST["huruf"]))

$huruf = $_POST["huruf"]; #fungsi untuk memasukan inputan dari form html ke PHP

$huruf2 = $_POST["huruf"]; #fungsi untuk memasukan inputan dari form html ke PHP

$huruf3 = $_POST["huruf"]; #fungsi untuk memasukan inputan dari form html ke PHP

do

$hasilbagi = $huruf%2;

$biner .= (String)$hasilbagi;
$huruf = intval($huruf/2); #fungsi agar pembagian tidak koma

}while($huruf != 0);

$biner = strrev($biner); #fungsi membalikkan String

do

$hasilbagi = $huruf2%8;

$oktal .= (String)$hasilbagi;

$huruf2 = intval($huruf2/8); #fungsi agar pembagian tidak koma

}while($huruf2 != 0);

//$oktal .= (String)$huruf2;

$oktal = strrev($oktal); #fungsi membalikkan String4

do

$hasilbagi = $huruf3 % 16;

switch($hasilbagi)

case 0 : $hexa .= "0";break;

case 1 : $hexa .= "1";break;

case 2 : $hexa .= "2";break;

case 3 : $hexa .= "3";break;

case 4 : $hexa .= "4";break;

case 5 : $hexa .= "5";break;

case 6 : $hexa .= "6";break;

case 7 : $hexa .= "7";break;

case 8 : $hexa .= "8";break;

case 9 : $hexa .= "9";break;

case 10 : $hexa .= "A";break;

case 11 : $hexa .= "B";break;


case 12 : $hexa .= "C";break;

case 13 : $hexa .= "D";break;

case 14 : $hexa .= "E";break;

case 15 : $hexa .= "F";break;

default: break;

}$huruf3 = intval($huruf3/16);

}while($huruf3 != 0);

$hexa = strrev($hexa);

if(isset($_POST["value"]))

if(isset($_POST["suhu1"]) && $_POST["suhu1"] == "cl")

$input = $_POST["value"];

$celcius = $input;

$fahrenheit = (1.8*$input)+32;

$reamur = 0.8 * $input;

$kelvin = $input + 273;

if(isset($_POST["suhu2"]) && $_POST["suhu2"] == "rm")

$input = $_POST["value"];

$celcius2 = 1.25*$input;

$fahrenheit2 = (2.25*$input)+32;

$reamur2 = $input;

$kelvin2 = 273+(1.25*$input);
}

if(isset($_POST["suhu3"]) && $_POST["suhu3"] == "fr")

$input = $_POST["value"];

$celcius3 = (5*($input-32))/9;

$fahrenheit3 = $input;

$reamur3 = (4*($input-32))/9;

$kelvin3 = ($input+ 459.67) / 1.8;

if(isset($_POST["suhu4"]) && $_POST["suhu4"] == "kn")

$input = $_POST["value"];

$celcius4 = $input - 273;

$fahrenheit4 = ($input*1.8)-459.67;

$reamur4 = (0.8*$input)-273;

$kelvin4 = $input; }

?>

<BR><h3>Soal C</h3> <BR>

<form action="" method="post">

<table>

<tr><td><label>Masukan Angka Decimal : </label></td><td><input type="number" name="huruf"


id="decimal"></td></tr>

</table><br>

<button type="submit">Cek!</button>

</form>
<br>

<table border="1">

<tr><td><h3>Hasil Biner = </h3></td><td><h3><?php echo"$biner";?></h3></td></tr>

<tr><td><h3>Hasil Oktal = </h3></td><td><h3><?php echo"$oktal";?></h3></td></tr>

<tr><td><h3>Hasil Hexa = </h3></td><td><h3><?php echo"$hexa";?></h3></td></tr>

</table>

<BR><h3>Soal D</h3> <BR>

<form action="" method ="post">

<table>

<tr><td><label>Masukan angka : </tr<label></td><td><input type="number" name="value"


id="decimal"></td></tr>

</table><br>

<table>
<tr><td><label>Ke Celcius </label></td><td><input type="checkbox" name="suhu1"
value="cl"></td></tr>

<tr><td><label>Ke Reamur </label></td><td><input type="checkbox" name="suhu2"


value="rm"></td></tr>

<tr><td><label>Ke Fahrenheit </label></td><td><input type="checkbox" name="suhu3"


value="fr"></td></tr>

<tr><td><label>Ke Kelvin </label></td><td><input type="checkbox" name="suhu4"


value="kn"></td></tr>

</table>

<button type="submit">Cek!</button>

</form>

<br><br>

<h3>Hasil :</h3><br>

<table border="1">
<tr><td>celcius : <?php echo"$celcius" ?></td><td>reamur : <?php echo"$reamur"
?></td><td>fahrenheit : <?php echo"$fahrenheit" ?></td><td>kelvin : <?php echo"$kelvin"
?></td></tr>

<tr><td>reamur : <?php echo"$reamur2" ?></td><td>celcius : <?php echo "$celcius2"


?></td><td>fahrenheit : <?php echo"$fahrenheit2" ?></td><td>kelvin : <?php echo"$kelvin2"
?></td></tr>

<tr><td>fahrenheit : <?php echo"$fahrenheit3" ?></td><td>reamur : <?php echo"$reamur3"


?></td><td>celcius : <?php echo "$celcius3" ?></td><td>kelvin : <?php echo"$kelvin3" ?></td></tr>

<tr><td>kelvin : <?php echo"$kelvin4" ?></td><td>reamur : <?php echo"$reamur4"


?></td><td>fahrenheit : <?php echo"$fahrenheit4" ?></td><td>celcius : <?php echo"$celcius4"
?></td></tr>

</table>

</body>

</html>

You might also like