About Me

header ads

CARA KONVERSI SUHU BERBASIS WEB JAVASCRIPT

Kali ini saya akan memposting bagaimana caranya membuat web konversi suhu berbasis web javascript menggunakan notepad plus .saat ini saya menggunakan nilai fahrenheit sebagai input nilai yang akan di hitung.

Langkah-Langkah :
1. pertama kalian siapkan dulu notepad plus
2. pahami rumus konversi suhu yaitu :


Konversi suhu dari Celcius (C) ke Reamur (R), Fahrenheit (F), dan Kelvin (K) adalah:
R = (4/5) C
F = (9/5) C + 32
K = C + 273
Konversi suhu dari Reamur (R) ke Celcius (C), Fahrenheit (F), dan Kelvin (K) adalah:
C = (5/4) R
F = (9/4) R + 32
K = C + 273 = (5/4) R + 273
Konversi suhu dari Fahrenheit (F) ke Celcius (C), Reamur (R), dan Kelvin (K) adalah:
C = 5/9 (F-32)
R = 4/9 (F-32)
K = 5/9 (F-32) + 273
Konversi suhu dari Kelvin (K) ke Celcius (C), Reamur (R), Fahrenheit (F) adalah:
C = K – 273
R = 4/5 (K-273)
F = 9/5 (K-273) + 32

3. buat tampilan sederhana HTML 

<html>
<body bgcolor="black">
<table width=50% border=3 bgcolor="green" bordercolor="blue" align="center" cellspacing=1 cellpadding=1>
<tr height="600px" valign="top">
<td>
"taruh sini kode javascript nya"

</td>

</html>

4. kemudian buat rumus javascript nya:

<script language="JavaScript" type="text/javascript">
fahrenheit = prompt("Masukan suhu (Fahrenheit)","");
celcius=parseInt((fahrenheit)-32) /1.8;
rheamur=celcius * 0.8;
kelvin=celcius + 273.15;

document.write("<center><font size=10 color='gold'>Perbandingan Suhu</font></center>","<br>");

document.write("<font size=5 color='gold'>=================================================</font>","<br>");
document.write("<font size=5 color='gold'>Fahrenheit = ",fahrenheit,"<sup>o</sup>F</font><br>");
document.write("<font size=5 color='gold'>Celcius = ",fahrenheit," - ",32," / ",1.8,"= ", celcius,"<sup>o</sup>C</font><br>");
document.write("<font size=5 color='gold'>Rheamur = ",celcius," * ",0.8," = ",rheamur,"<sup>o</sup>R</font><br>");
document.write("<font size=5 color='gold'>Kelvin = ",celcius," + ",273.15," = ",kelvin,"<sup>o</sup>K</font><br>");
document.write("<font size=5 color='gold'>=================================================</font>","<br>");


</script>


5. kemudian save dengan format : nama.html
6. lalu running ke browser 
7. maka ini hasilnya fahrenheit 70




hasil:


semoga bermanfaat ya....





Post a Comment

1 Comments