Program Konversi Suhu PHP

program konversi suhu php

Pada kesempatan ini kita akan membuat program konversi suhu. program ini termasuk kedalam program sederhana, karena hanya memasukkan proses aritmatika didalamnya.

#Tampilan

header.html:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Belajar Php</title>
<link rel="stylesheet" type="text/css" href="style.css" /> <!Memanggil style css>
</head>
<body>
<div id="sampul"> <!div id= membuat class css dengan nama header>


<div id="header">
<center><h2>Belajar PHP</h2></center>
<div id="linkHeader">
<h4><a href="index.php">Beranda</a></h4>
</div>
</div>
<div id="body">
<div id="SidebarKiri">

</div>
<div id="isi">

</body>
</html>


footer.html:

<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html>
<body>
</div>
<div id="SidebarKanan">

</div>
</div>
<div id="footer">
<h2>Java Kita</h2>
</div>

</div>
</body>
</html>


style.css:

/*
Document : style
Created on : Sep 13, 2013, 3:27:50 PM
Author : Razaq
Description:
Purpose of the stylesheet follows.
*/

body{
background-color: #999999;
margin: 0px;
padding: 0px;
}

#sampul{ /*membuat class sampul di css */
margin: auto;
width: 900px;
clear: both; /*berhubungan dengan posisi text pada isi nanti */
text-align: center;
/*kita gunakan sampul supaya semuanya otomatis di tengah*/
}

#header{
height: 197px;
background-color: #0066ff;
padding: 20px;
text-align: left;
}

#linkHeader{
margin-top: 140px;
margin-left: 0;
text-align: left;

}

#body{
background-color: #cc0099;
clear: both;
display: table-row;

}

#SidebarKiri{
float: left;
width: 200px;
margin:0;
padding:10px;
border: 0;
clear: both;
background-color: #cc0099;
}
#isi{
float: left;
width: 440px;
margin:0;
padding:10px;
border: 0;
background-color: #cc00cc;
text-align: justify;
}
#SidebarKanan{
float: right;
width: 200px;
margin:0;
padding:10px;
border: 0;
background-color: #cc0099;
}

#footer{
height: 120px;
border: 0;
clear:both;
background-color: #9900cc;
padding: 20px;

}


#Program

footer.html:

<?php
include 'header.html';
?>
<form method="post">
<table border="0">
<tr>
<td>Masukkan Nilai Suhu: </td>
<td><input type="text" size="15" name="suhu" /></td>
<td><input type="submit" value="Proses" name="Proses"</td>
</tr>
</table>
</form>

<?php
if(isset($_POST['Proses'])){

$suhu = isset($_POST['suhu'])? $_POST['suhu']:NULL;
echo '<h3>Celcius</h3>';
echo 'Celsius = ';
echo $suhu;
echo '<br/>';
echo 'Kelvin = ';
echo $suhu + 273;
echo '<br/>';
echo 'Fahrenheit = ';
echo $suhu*1.8+32;

echo '<h3>Kelvin</h3>';
echo 'Kelvin = ';
echo $suhu;
echo '<br/>';
echo 'Celcius = ';
echo $suhu - 273.15;
echo '<br/>';
echo 'Fahrenheit = ';
echo $suhu * 1.8 - 459.67;

echo '<h3>Fahrenheit</h3>';
echo 'Fahrenheit = ';
echo $suhu;
echo '<br/>';
echo 'Celsius = ';
echo ($suhu-32)/1.8;
echo '<br/>';
echo 'Kelvin = ';
echo ($suhu+459.67)/1.4;;



}
?>
<?php
include 'footer.html';
?>

Outputnya seperti gambar di atas

0 comments:

Ada pertanyaan?? Silahkan tanyakan di kotak komentar .. :)

Program Konversi Suhu C++

Pada kesempatan kali ini kita akan membuat program konversi suhu menggunakan c++. Rumus dari konversi suhu ini saya ambil di wikipedia. tidak ada hal baru disini, program ini hanyalah pengembangan dari program aritmatika, sangat sederhana dengan menggunakan tipe data float agar dapat mencetak bilangan desimal.

Program Konversi Suhu C++

#include <iostream.h>
#include <conio.h>
void main(){
      clrscr();
float suhu;
cout<<"Program konversi suhu celsius, kelvin, fahrenheit";
cout<<"\nMasukkan nilai temperatur = ";
cin>>suhu;
cout<<"\n\n~Celsius";
cout<<"\nCelsius = "<<suhu;
float k1=suhu+273.15;
cout<<"\nKelvin = "<<k1;
float f1=suhu*1.8+32;
cout<<"\nFahrenheit = "<<f1;
cout<<"\n\n~Kelvin";
cout<<"\nKelvin = "<<suhu;
float c2=suhu-273.15;
cout<<"\nCelsius = "<<c2;
float f2=suhu*1.8-459.67;
cout<<"\nFahrenheit = "<<f2;
cout<<"\n\n~Fahrenheit";
cout<<"\nFahrenheit = "<<suhu;
float c3= (suhu-32)/1.8;
cout<<"\nCelsius = "<<c3;
float k3 = (suhu+459.67)/1.4;
cout<<"\nKelvin = "<<k3;
}
Output. 
output program konversi suhu

0 comments:

Ada pertanyaan?? Silahkan tanyakan di kotak komentar .. :)

Aplikasi Konversi Suhu Menggunakan Java

Kali ini kita akan membuat program yang sangat sederhana. yaitu program konversi suhu. program ini merupakan pengembangan dari program aritmatika yang telah kita buat sebelumnya. kalau kita paham program aritmatika sebelumnya, maka sangatlah mudah untuk membuat program yang satu ini. berikut programnya

Aplikasi Konversi Suhu Menggunakan Java

package javaapplication1;
import java.util.Scanner;
/**
 *
 * @author Razaq Nice
 */
public class suhu {
    public static void main (String[] args){
        Scanner input = new Scanner(System.in);
        double suhu,celsius,kelvin,fahrenheit;
       
        System.out.println("Program Konversi Suhu Celsius, Kelvin, Fahrenheit");
        System.out.print("Masukkan Nilai Temperatur(derajat) = ");
        suhu =input.nextDouble();
       
        System.out.println("\n~Celsius");
        System.out.println("Celsius = "+suhu);
        double kk=suhu+273.15;
        System.out.println("Kelvin = "+kk);
        double ff = suhu*1.8+32;
        System.out.println("Fahrenheit = "+ff);
       
        System.out.println("\n~Kelvin");
        System.out.println("Kelvin = "+suhu);
        double c = suhu - 273.15;
        System.out.println("Celsius = "+c);
        double f = suhu * 1.8 - 459.67;
        System.out.println("Fahrenheit = "+f);
       
        System.out.println("\nFahrenheit");
        System.out.println("Fahrenheit = " + suhu);
        double c1= (suhu-32)/1.8;
        System.out.println("Celsius = "+c1);
        double k1= (suhu+459.67)/1.4;
        System.out.println("Kelvin = "+k1);
       
       
       
       
    }
   
}
Output
aplikasi konversi suhu java

0 comments:

Ada pertanyaan?? Silahkan tanyakan di kotak komentar .. :)