TUGAS 2 Prak. Web II
Layout |
<html>
<head><title>Menentukan Suhu Drajat</title></head>
<body>
<form method="POST">
Masukan Suhu:
<input type="text" size="4" name="temp"><sup>o</sup>C<br>
<input type="submit" name="proses" value="Hitung">
<br><br>
<?php
$temp=$_POST['temp'];
if (isset($proses))
{
echo "Suhu sekarang : ".$temp."<sup>o</sup>C<br>";
echo "Fahrenheit : ";
echo 32+$temp/5*9;
echo "<sup>o</sup>C<br>";
echo "Kelvin : ";
echo $temp+273.1;
echo "<sup>o</sup>K<br>";
echo "Wujud air : ";
switch($temp)
{
case ($temp<0) : {echo "<font color='red'><b>membeku</b></font>";
$aktifitas="bermain ski";break;}
case ($temp>100) : {echo "<font color='red'><b>beruap</b></font>";
$aktifitas="sauna bathing";break;}
default : {echo "<font color='red'><b>mencair</b></font>";
$aktifitas="berenang";break;}
}
echo "<br> Aktivitas yg cocok dilakukan : ".$aktifitas;
}
?>
</form>
</body>
</html>
Tidak ada komentar:
Posting Komentar