Pages

Aplikasi Konvertor Suhu Berbasis Java Netbeans

Nama : Henry Taswin
NIM   : 161021450263
Kelas : 02TPLE004 / 514

Judul Aplikasi : Konvertor Suhu

Deskripsi :
Aplikasi ini untuk mengkonversi suhu Celcius, Fahrenheit, Reamur dan Kelvin dengan menggunakan aplikasi ini memudahkan untuk melihat hasil konversi dari suhu tersebut dengan menggunakan 4 opsi untuk menentukan suhu awal dan akan memberikan hasil output dari keempat suhu tersebut.



Flowchart :



Screenshoot :



Saat melakukan konversi dan memberikan output hasil conversinya.

Sourcecode :
/**
 *
 * @author 104kHz a.k.a Henry Taswin
 * 161021450263 - 514 
 * UTS Lab. Algoritma & Pemrograman
 * STMIK ERESHA - PAMULANG
 */

public class henry_ks extends javax.swing.JFrame {
    public Double input;
    public Double celcius;
    public Double fahrenheit;
    public Double reamur;
    public Double kelvin;
    public String hcelcius;
    public String hfahrenheit;
    public String hreamur;
    public String hkelvin;
    
            
    /**
     * Creates new form henry_ks
     */
    public henry_ks() {
        initComponents();
        grpbtn();
        
    }
    
    private void celcius(){
        input=Double.parseDouble(sa.getText());
        
        celcius=input;
        fahrenheit=celcius*1.8+32;
        reamur=celcius*0.8;
        kelvin=celcius+273.15;
        
        hcelcius=Double.toString(celcius);
        txtc.setText(hcelcius);
        
        hfahrenheit=Double.toString(fahrenheit);
        txtf.setText(hfahrenheit);
        
        hreamur=Double.toString(reamur);
        txtr.setText(hreamur);
        
        hkelvin=Double.toString(kelvin);
        txtk.setText(hkelvin);        
    }
    private void fahrenheit(){
        input=Double.parseDouble(sa.getText());
        
        fahrenheit=input;
        celcius=(fahrenheit-32)/1.8;
        reamur=(fahrenheit-32)/2.25;
        kelvin=(fahrenheit+459.67)/1.8;
        
        hcelcius=Double.toString(celcius);
        txtc.setText(hcelcius);
        
        hfahrenheit=Double.toString(fahrenheit);
        txtf.setText(hfahrenheit);
        
        hreamur=Double.toString(reamur);
        txtr.setText(hreamur);
        
        hkelvin=Double.toString(kelvin);
        txtk.setText(hkelvin);
    }
    
    private void reamur(){
        input=Double.parseDouble(sa.getText());
        
        reamur=input;
        celcius=reamur/0.8;
        fahrenheit=(reamur*2.25)+32;
        kelvin=reamur/0.8+237.15;
        
        hcelcius=Double.toString(celcius);
        txtc.setText(hcelcius);
        
        hfahrenheit=Double.toString(fahrenheit);
        txtf.setText(hfahrenheit);
        
        hreamur=Double.toString(reamur);
        txtr.setText(hreamur);
        
        hkelvin=Double.toString(kelvin);
        txtk.setText(hkelvin);   
    }
    
    private void kelvin(){
        input=Double.parseDouble(sa.getText());
        
        kelvin=input;
        celcius=kelvin-273.15;
        fahrenheit=kelvin*1.8-459.67;
        reamur=(kelvin-273.15)*0.8;
        
        hcelcius=Double.toString(celcius);
        txtc.setText(hcelcius);
        
        hfahrenheit=Double.toString(fahrenheit);
        txtf.setText(hfahrenheit);
        
        hreamur=Double.toString(reamur);
        txtr.setText(hreamur);
        
        hkelvin=Double.toString(kelvin);
        txtk.setText(hkelvin);
    }
    
    private void grpbtn(){
        buttonGroup1.add(rbc);
        buttonGroup1.add(rbf);
        buttonGroup1.add(rbk);
        buttonGroup1.add(rbr);
    }
 
 private void konversiActionPerformed(java.awt.event.ActionEvent evt) {                                         
        // TODO add your handling code here:
        // coding dibawah ini untuk menggunakan if else if
        // Henry Taswin
        
        if(rbc.isSelected()){
            celcius();
        }
        else if(rbf.isSelected()){
            fahrenheit();
        }
        else if(rbk.isSelected()){
            kelvin();
        }
        else if(rbr.isSelected()){
            reamur();
        }
             
        
    }                                        

    private void quitActionPerformed(java.awt.event.ActionEvent evt) {                                     
        // TODO add your handling code here:
        this.dispose();
    }                                    

    private void bersihkanActionPerformed(java.awt.event.ActionEvent evt) {                                          
        // TODO add your handling code here:
        sa.setText("");
        txtc.setText("");
        txtf.setText("");
        txtk.setText("");
        txtr.setText("");
    }                                         

    private void formWindowActivated(java.awt.event.WindowEvent evt) {                                     
        // TODO add your handling code here:
        
    }                                    

    private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {                                           
        // TODO add your handling code here:
        aboutht ht = new aboutht();
        ht.setVisible(true);
            
        
    }         
 

No comments:

Post a Comment

What's on your mind