Tugas Algoritma

Nama : Ady Nugraha
NIM : 161021450264
Kelas : 02TPLP001



// TODO add your handling code here:
        brownis = (String)jComboBox1.getSelectedItem();
        if (brownis == "Pilih"){
            txtharga.setText("");
            txtpotongan.setText("");
            txttotal.setText("");
        }
        else if (brownis == "Brownis Keju"){
            harga = 35000;
                 
            txtharga.setText(""+harga);
        }
        else if (brownis == "Brownis Coklat"){
            harga = 40000;
                 
            txtharga.setText(""+harga);
        }
        else if (brownis == "Brownis Pisang"){
            harga = 30000;
                 
            txtharga.setText(""+harga);
        }
        else if (brownis == "Brownis Kacang"){
            harga = 32000;
                 
            txtharga.setText(""+harga);
        }
        else if (brownis == "Brownis Nanas"){
            harga = 45000;
                 
            txtharga.setText(""+harga);
        }
        else if (brownis == "Brownis Strawberry"){
            harga = 25000;
                 
            txtharga.setText(""+harga);
        }
     
    }                                       

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

    private void txtqtyFocusLost(java.awt.event.FocusEvent evt) {                               
        // TODO add your handling code here:
     
       int harga =Integer.parseInt(txtharga.getText());
                int Qty =Integer.parseInt(txtqty.getText());
                int total = harga*Qty;
                txttotal.setText(""+total);
    }                             

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

    private void jRadioButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                           
        // TODO add your handling code here:
        if (jRadioButton1.isSelected()){
            double totalnya = Double.parseDouble(txttotal.getText());
         
            if(totalnya>=100000){
                double potongan = totalnya * 0.10;
                double nett = totalnya - potongan;
                txtnett.setText("Rp "+nett);
                txtpotongan.setText("Rp "+potongan);
            }
            else{
                txtpotongan.setText(""+0);
                double potongan = totalnya * 0;
                double nett = totalnya - potongan;
                txtnett.setText("Rp "+nett);
             
            }
        }
     
    }                     

Komentar

Posting Komentar

Postingan populer dari blog ini

UAS Basis Data II

UTS Pemograman I