- Beranda
- Programmer Forum
[ASK] Pengertian Codding Java
...
TS
jazulyshs
[ASK] Pengertian Codding Java
Bro para Suhu Semuanya Ane Minta Pengertian darisetiap codding program di bawah donk...
ane masih kurang ngerti, ini, makasih bro
Ini contoh program Konversi Suhu...
Hasilnya gini kalo di jalankan
![[ASK] Pengertian Codding Java](https://dl.kaskus.id/i.picresize.com/images/2014/12/09/L7okN.jpg)
ane masih kurang ngerti, ini, makasih bro

Ini contoh program Konversi Suhu...
Code:
import javax.swing.JOptionPane;
public class Suhu {
public static void main(String dian [] ) {
double hasil = 0;
String pilihan = JOptionPane.showInputDialog("Masukan Pilihan No. Anda : \n1. Reamur ke Fahrenheit \n2. Fahrenheit ke Reamur \n3. Celcius ke Reamur \n4. Reamur ke Celcius \n5. Celcius ke Fahrenheit \n6. Fahrenheit ke Celcius ");
int pilih = Integer.parseInt(pilihan);
switch (pilih) {
case 1:
{String RkeF = JOptionPane.showInputDialog("Masukan Reamur = ");
double rf = Integer.parseInt(RkeF);
hasil = (rf * 2.25) + 32;}
JOptionPane.showMessageDialog(null, "Hasil = " +hasil+ " Fahreinheit","info", JOptionPane.INFORMATION_MESSAGE);
break;
case 2:
{String FkeR = JOptionPane.showInputDialog("Masukan Fahrenheit = ");
double fr = Integer.parseInt(FkeR);
hasil = (fr -32) / 2.25;}
JOptionPane.showMessageDialog(null, "Hasil = " +hasil+ " Reamur","info", JOptionPane.INFORMATION_MESSAGE);
break;
case 3:
{String CkeR = JOptionPane.showInputDialog("Masukan Celcius = ");
double cr = Integer.parseInt(CkeR);
hasil = cr * 0.8;}
JOptionPane.showMessageDialog(null, "Hasil = " +hasil+ " Reamur","info", JOptionPane.INFORMATION_MESSAGE);
break;
case 4:
{String RkeC = JOptionPane.showInputDialog("Masukan Reamur = ");
double rc = Integer.parseInt(RkeC);
hasil = rc / 0.8;}
JOptionPane.showMessageDialog(null, "Hasil = " +hasil+ " Celcius","info", JOptionPane.INFORMATION_MESSAGE);
break;
case 5:
{String CkeF = JOptionPane.showInputDialog("Masukan Celcius = ");
double cf = Integer.parseInt(CkeF);
hasil = (cf * 1.8) + 32;}
JOptionPane.showMessageDialog(null, "Hasil = " +hasil+ " Fahrenheit","info", JOptionPane.INFORMATION_MESSAGE);
break;
case 6:
{String FkeC = JOptionPane.showInputDialog("Masukan Fahrenheit = ");
double fc = Integer.parseInt(FkeC);
hasil = (fc - 32) / 1.8;}
JOptionPane.showMessageDialog(null, "Hasil = " +hasil+ " Celsius","info", JOptionPane.INFORMATION_MESSAGE);
break;
}}}
Hasilnya gini kalo di jalankan
![[ASK] Pengertian Codding Java](https://dl.kaskus.id/i.picresize.com/images/2014/12/09/L7okN.jpg)
Diubah oleh jazulyshs 09-12-2014 22:26
0
916
2
Komentar yang asik ya
Mari bergabung, dapatkan informasi dan teman baru!
Programmer Forum
20.2KThread•4.9KAnggota
Urutkan
Terlama
Komentar yang asik ya