Selasa, 31 Januari 2012

Program Untuk Menghitung Celius ( Java Swing )

import javax.swing.*;
public class celcius
{
public static void main (String anjing [])
{
String input=JOptionPane.showInputDialog("masukan Nilai");//input secara mesej
double c = Double.parseDouble(input);
double f = (1.8*c)+32;

JOptionPane.showMessageDialog(null,"Fahrenheit = "+f,
"Info",JOptionPane.INFORMATION_MESSAGE);//output secara mesej fahrenheit
double k = c + 273;

JOptionPane.showMessageDialog(null,"Kelvin    ="+k,
"Info",JOptionPane.INFORMATION_MESSAGE);//output secara mesej kelvin
double r = (0.8*c);

JOptionPane.showMessageDialog(null,"Reamur    ="+r,
"Info",JOptionPane.INFORMATION_MESSAGE);//output secara mesej reamur

System.exit(0);
}}





Tidak ada komentar:

Posting Komentar