Sunday, April 5, 2015

Menggunakan Perintah Switch pada NetBeans





Code Program Proses :

 private void eprosesActionPerformed(java.awt.event.ActionEvent evt) {                                       
        // TODO add your handling code here:
        int a;
        String b;
        a=Integer.parseInt(ebil.getText());
        switch(a){
            case 1:b="Pilihan Pertama";
               eket.setText(""+b);
               break;
            case 2:b="Pilihan Kedua";
                eket.setText(""+b);
                break;
            case 3:b="Pilihan Ketiga";
                eket.setText(""+b);
                break;
            case 4:b="Pilihan Keempat";
                eket.setText(""+b);
                break;
            case 5:b="Pilihan Kelima";
                eket.setText(""+b);
                break;
            default:b="Pilihan Default";
                eket.setText(""+b);
                break;
        }
    }                                      

    private void ebatalActionPerformed(java.awt.event.ActionEvent evt) {                                      
        // TODO add your handling code here:
        ebil.setText("");
        eket.setText("");
       
    }                                     

0 comments:

Post a Comment