A College Student Blog

Hafiz Anshori

Developer

Freelancer

Coder

Saturday, 15 December 2018

Program Java Sederhana : Konverter Suhu
Pertama-tama tambahkan helper class pada bagian atas
import java.util.Scanner;
kemudian tambahkan variabel fahrenheit dan celcius
double fahrenheit,celcius;
Setelah itu kita tambahkan input scanner untuk mendapatkan nilai yang akan di konversi nantinya
Scanner input = new Scanner(System.in);
  System.out.println("Masukkan Suhu Celcius : ");
  celcius = input.nextInt();
Kemudian masukkan rumus konversi dari celcius ke fahrenheit
fahrenheit = celcius * 9/5 +32
Dan terakhir kita berikan outputnya
System.out.println("Hasil Konversi Suhu Celcius Ke Fahrenheit : "+fahrenheit);
dan jalankan.
Full Code
import java.util.Scanner;
  public class TempClass {
     public static void main(String[] args) {
        double fahrenheit,celcius;
      
        Scanner input = new Scanner(System.in);
      
        System.out.println("Masukkan Suhu Celcius : ");
        
        celcius = input.nextInt();
        
        fahrenheit = celcius * 9/5 +32
        
        System.out.println("Hasil Konversi Suhu Celcius Ke Fahrenheit : "+fahrenheit);
     }
  }

"Modern technology has become a total phenomenon for civilization, the defining force of a new social order in which efficiency is no longer an option but a necessity imposed on all human activity." - Jacques Ellul

0 Comments:

Post a Comment

Contact Me

Adress/Street

Jl. H. Mistar Cokrokusumo No.23, Bangkal, Cempaka, Kota Banjar Baru, Kalimantan Selatan 70732

Whatsapp

+(62) 852-4618-5715

Line

@iamfisherz

Website

www.hans-mf.blogspot.com

Type and Press Enter