Skip to content

Instantly share code, notes, and snippets.

@mahirrudin
Last active August 29, 2015 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mahirrudin/e1b18167fae2d537695f to your computer and use it in GitHub Desktop.
Save mahirrudin/e1b18167fae2d537695f to your computer and use it in GitHub Desktop.
Java CLI - Conversion Temperature
import javax.swing.*;
public class KonversiTemperatur {
public static void main(String[] args) {
double tempC, tempR, tempF;
String bilangan = JOptionPane.showInputDialog("Masukkan Celcius : ");
System.out.println("Masukkan angka : " + bilangan);
tempC = Double.parseDouble(bilangan);
tempR = tempC*4/5;
tempF = tempC*9/5+32.0;
System.out.println("Temperature Celcius = " + tempC );
System.out.println("Temperature Reamur = " + tempR );
System.out.println("Temperature Fahrenheit = " + tempF );
System.exit(0);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment