Input temperatur Celcius, kemudian dikonvesi ke Reamur dan Fahrenheit


import javax.swing.*;

public class KonversiTemperatur
{
public static void main (String[ ] args)
{
double tempC, tempR, tempF;
String bilangan = JOptionPane.showInputDialog(“Input Celcius:”);
System.out.println(“Input angka: ” + bilangan);
tempC = Double.parseDouble(bilangan);

tempR = tempC * 4 / 5 ;
tempF = tempC * 9 / 5 + 32.0;
System.out.println (“Temperatur Celcius = ” + tempC);
System.out.println (“Temperatur Reamur = ” + tempR);
System.out.println (“Temperatur Fahrenheit = ” + tempF);
System.exit(0);
}
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s