/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package inputan_suhu;
/**
*
* @author RETNO
*/
public class Main {
public float celcius;
private float hasilR, hasilK, hasilF;
public float K;
public float R;
public float F;
public void hasil(){
this.R = (float)(this.celcius * 0.8);
this.K = (float)(this.celcius + 273.15);
this.F = (float)(this.celcius * 1.8 + 32);
}
public void tampilkanHasilR(){
System.out.println("hasil Reamur adalah:"+this.R);
}
public void tampilkanHasilK(){
System.out.println("hasil Kelvin adalah:"+this.K);
}
public void tampilkanHasilF(){
System.out.println("hasil Fahrenhait adalah:"+this.F);
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
Main op1 = new Main();
op1.celcius=30;
op1.hasil();
op1.tampilkanHasilR();
op1.tampilkanHasilK();
op1.tampilkanHasilF();
op1.celcius=45;
op1.hasil();
op1.tampilkanHasilR();
op1.tampilkanHasilK();
op1.tampilkanHasilF();
}
}
Tidak ada komentar:
Posting Komentar