Sintak Konversi Suhu dengan Bahasa Pemograman Java
Langkah 1
Buka Notepad ++ atau Notepad Biasa
Langkah 2
Masukkan Sintak berikut:
import java.util.Scanner;
public class konversisuhu
{
public static void main(String args[])
{Scanner input=new Scanner(System.in);
int cel;
float fah,kel,rea;
System.out.println();
System.out.println(" =======================================");
System.out.print(" Masukkan Derajat Celsius : ");
cel=input.nextInt();
System.out.println(" =======================================");
fah=9f/5f*cel+32f;
kel=cel+273f;
rea=9f/5f*cel;
System.out.println();
System.out.println("[=->>-==--==--==--==--==--==--==--==--==--==--==--==<<-=]");
System.out.println("[=->>=--==--==--==--==--==--==--==--==--==--==--==--<<-=]");
System.out.println();
System.out.println(" [>>>=======================================<<<]");
System.out.println(" ---- Hasil Konversi Suhu ---- ");
System.out.println(" [>>>=======================================<<<]");
System.out.println(" Fahrenheit = "+fah);
System.out.println(" Kelvin = "+kel);
System.out.println(" Reaumur = "+rea);
System.out.println(" [>>>=======================================<<<]");
System.out.println(" ---- Thank's You ---- ");
System.out.println(" [>>>=======================================<<<]");
System.out.println();
System.out.println("[=->>-==--==--==--==--==--==--==--==--==--==--==--==<<-=]");
System.out.println("[=->>=--==--==--==--==--==--==--==--==--==--==--==--<<-=]");
}
}
Langkah 3
Buka Command Prompt
EmoticonEmoticon