Part 1 || Contoh Aplikasi Program Simple Buat Klinik - Kenal Coding

Part 1 || Contoh Aplikasi Program Simple Buat Klinik

    Hay, sahabat Coding....gimana kabarnya kalian? Kali ini saya akan menjelaskan bagaimana cara membuat "Program Aplikasi Simple Buat Klinik" di Netbeans.
Saya akan membuat 7 aplikasi, tapi kali ini saya menjelaskan aplikasi yang "pertama"
    Langsung aja kita masuk ke penjelasannya.


contoh aplikasi simple buat klinik (with netbeans)

Ini hasil Aplikasi yang sudah di Run

Untuk Source Codenya :

  • Deklarasi Global Variabel Integer :
public class Klinik_Medical_Center extends javax.swing.JFrame {
    int biayaadmin, konsultasi, obat, diskon,totalharga, total;

    /**
     * Creates new form Klinik_Medical_Center
     */
    public Klinik_Medical_Center() {
        initComponents();
    }


  • Coding pada action Radio Button (Umum, Gigi, dan Saraf) :
private void rbUmumActionPerformed(java.awt.event.ActionEvent evt) {                                    
        // TODO add your handling code here:
        if (rbUmum.isSelected()) {
            txtnadok.setText("Mahfud Akbar");
            txtwktpraktek.setText("Pagi");
        }
    }                                    

    private void rbGigiActionPerformed(java.awt.event.ActionEvent evt) {                                    
        // TODO add your handling code here:
        if (rbGigi.isSelected()) {
            txtnadok.setText("Mutia Khanza");
            txtwktpraktek.setText("Sore");
        }
    }                                    

    private void rbSarafActionPerformed(java.awt.event.ActionEvent evt) {                                      
        // TODO add your handling code here:
        if (rbSaraf.isSelected()) {
            txtnadok.setText("Annisa Susilowati");
            txtwktpraktek.setText("Malam");
        }
    }


  • Coding pada action Combo Box Nama Ruang :
private void NamaRuangComboActionPerformed(java.awt.event.ActionEvent evt) {                                            
        // TODO add your handling code here:
        if (NamaRuangCombo.getSelectedItem().equals("Kenanga")) {
        txtharga.setText("200000");
            int harga = Integer.parseInt(txtharga.getText());
            int lama = Integer.parseInt(txtlama.getText());
            int totalharga = harga * lama;
            int potongan1 = totalharga * 10 / 100;
            int potongan2 = totalharga * 0;
            if (lama > 4) {
                diskon = potongan1;
                txtdiskon.setText(Integer.toString(potongan1));
                total = totalharga - diskon + biayaadmin + obat + konsultasi;
                txttotal.setText(String.valueOf(total));
            } else {
                diskon = potongan2;
                txtdiskon.setText(Integer.toString(potongan2));
                total = totalharga - diskon + biayaadmin + obat + konsultasi;
                txttotal.setText(String.valueOf(total));
            }
        }
        else if (NamaRuangCombo.getSelectedItem().equals("Mawar")){
        txtharga.setText("300000");
            int harga = Integer.parseInt(txtharga.getText());
            int lama = Integer.parseInt(txtlama.getText());
            int totalharga = harga * lama;
            int potongan1 = totalharga * 10 / 100;
            int potongan2 = totalharga * 0;
            if (lama > 4) {
                diskon = potongan1;
                txtdiskon.setText(Integer.toString(potongan1));
                total = totalharga - diskon + biayaadmin + obat + konsultasi;
                txttotal.setText(String.valueOf(total));
            } else {
                diskon = potongan2;
                txtdiskon.setText(Integer.toString(potongan2));
                total = totalharga - diskon + biayaadmin + obat + konsultasi;
                txttotal.setText(String.valueOf(total));
            }
        }
        else if (NamaRuangCombo.getSelectedItem().equals("Melati")){
        txtharga.setText("400000");
            int harga = Integer.parseInt(txtharga.getText());
            int lama = Integer.parseInt(txtlama.getText());
            int totalharga = harga * lama;
            int potongan1 = totalharga * 10 / 100;
            int potongan2 = totalharga * 0;
            if (lama > 4) {
                diskon = potongan1;
                txtdiskon.setText(Integer.toString(potongan1));
                total = totalharga - diskon + biayaadmin + obat + konsultasi;
                txttotal.setText(String.valueOf(total));
            } else {
                diskon = potongan2;
                txtdiskon.setText(Integer.toString(potongan2));
                total = totalharga - diskon + biayaadmin + obat + konsultasi;
                txttotal.setText(String.valueOf(total));
            }
        }
    }      


  • Coding pada action CheckBox Administrasi :
private void CheckBoxAdministrasiActionPerformed(java.awt.event.ActionEvent evt) {                                                  
        // TODO add your handling code here:
        if (CheckBoxAdministrasi.isSelected()) {
            biayaadmin = 5000;
            txtadmin.setText(String.valueOf(biayaadmin));
            int harga = Integer.parseInt(txtharga.getText());
            int lama = Integer.parseInt(txtlama.getText());
            int totaldiskon = Integer.parseInt(txtdiskon.getText());
            total = (harga * lama) - totaldiskon + biayaadmin + konsultasi + obat;
            txttotal.setText(String.valueOf(total));
        } else {
            biayaadmin = 0;
            txtadmin.setText(String.valueOf(biayaadmin));
            int harga = Integer.parseInt(txtharga.getText());
            int lama = Integer.parseInt(txtlama.getText());
            int totaldiskon = Integer.parseInt(txtdiskon.getText());
            total = (harga * lama) - totaldiskon + biayaadmin + konsultasi + obat;
            txttotal.setText(String.valueOf(total));
        }
    }


  • Coding pada action  CheckBox Konsultasi :
private void CheckBoxKonsultasiActionPerformed(java.awt.event.ActionEvent evt) {                                                
        // TODO add your handling code here:
        if (CheckBoxKonsultasi.isSelected()) {
            konsultasi = 20000;
            txtkonsultasi.setText(String.valueOf(konsultasi));
            int harga = Integer.parseInt(txtharga.getText());
            int lama = Integer.parseInt(txtlama.getText());
            int totaldiskon = Integer.parseInt(txtdiskon.getText());
            total = (harga * lama) - totaldiskon + biayaadmin + konsultasi + obat;
            txttotal.setText(String.valueOf(total));
        } else {
            konsultasi = 0;
            txtkonsultasi.setText(String.valueOf(konsultasi));
            int harga = Integer.parseInt(txtharga.getText());
            int lama = Integer.parseInt(txtlama.getText());
            int totaldiskon = Integer.parseInt(txtdiskon.getText());
            total = (harga * lama) - totaldiskon + biayaadmin + konsultasi + obat;
            txttotal.setText(String.valueOf(total));
        }
    }  


  • Coding pada action CheckBox Obat :
private void CheckBoxObatActionPerformed(java.awt.event.ActionEvent evt) {                                          
        // TODO add your handling code here:
        if (CheckBoxObat.isSelected()) {
            obat = 50000;
            txtobat.setText(String.valueOf(obat));
            int harga = Integer.parseInt(txtharga.getText());
            int lama = Integer.parseInt(txtlama.getText());
            int totaldiskon = Integer.parseInt(txtdiskon.getText());
            total = (harga * lama) - totaldiskon + biayaadmin + konsultasi + obat;
            txttotal.setText(String.valueOf(total));
        } else {
            obat = 0;
            txtobat.setText(String.valueOf(obat));
            int harga = Integer.parseInt(txtharga.getText());
            int lama = Integer.parseInt(txtlama.getText());
            int totaldiskon = Integer.parseInt(txtdiskon.getText());
            total = (harga * lama) - totaldiskon + biayaadmin + konsultasi + obat;
            txttotal.setText(String.valueOf(total));
        }
    }


  • Coding pada action Button Bersih :
private void btnbersihActionPerformed(java.awt.event.ActionEvent evt) {                                        
        // TODO add your handling code here:
        CheckBoxKonsultasi.setSelected(false);
        txtkonsultasi.setText("");
        CheckBoxAdministrasi.setSelected(false);
        txtadmin.setText("");
        CheckBoxObat.setSelected(false);
        txtobat.setText("");
        NamaRuangCombo.setSelectedIndex(0);
        txtlama.setText("");
        txtharga.setText("");
        txtnadok.setText("");
        txtdiskon.setText("");
        rbtngrpjepol.clearSelection();
        txttotal.setText("");
        txtnopasien.setText("");
        txtnamapasien.setText("");
        txtwktpraktek.setText("");
    }


  • Coding pada action Button Keluar :
private void btnkeluarActionPerformed(java.awt.event.ActionEvent evt) {                                        
        // TODO add your handling code here:
        int balas = JOptionPane.showConfirmDialog(null, "Yakin ingin keluar ?", "Konfirmasi Keluar Aplikasi", JOptionPane.YES_NO_OPTION);
        if (balas == JOptionPane.YES_OPTION) {
            System.exit(0);
        }
    }

   Sekian dari penjelasan tadi, mungkin jauh dikatakan sempurna. Dan semoga bermanfaat bagi sahabat coding, jangan pernah takut untuk mencoba.
"Success is a journey, not a destination" ~ Ben Sweetland

Previous
Next Post »