package thonbadawi.aji;
import javax.swing.JOptionPane;
public class tokobaju_method extends javax.swing.JFrame {
int merk,harga,beli;
double total,bayar,diskon;
@SuppressWarnings("unchecked")
private void
cmerkActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add
your handling code here:
if (rcelana.isSelected()==true)
celana();
if (rkemeja.isSelected()==true)
kemeja();
}
private void
rcelanaActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add
your handling code here:
cmerk.removeAllItems();
cmerk.addItem("- Pilih Merek Celana -");
cmerk.addItem("Carvile");
cmerk.addItem("Lea ");
cmerk.addItem("Marvel");
}
private void
rkemejaActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add
your handling code here:
cmerk.removeAllItems();
cmerk.addItem("- Pilih Merek Celana -");
cmerk.addItem("C59");
cmerk.addItem("Dagadu");
cmerk.addItem("Exlusife");
}
private void
ebeliActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add
your handling code here:
beli = Integer.parseInt(ebeli.getText());
total = harga*beli;
etotal.setText(String.valueOf(total));
if (total>500000)
diskon =
total*15/100;
else if (total>250000)
diskon =
total*5/100;
else diskon = 0;
ediskon.setText(String.valueOf(diskon));
bayar=total-diskon;
ebayar.setText(String.valueOf(bayar));
}
private void
bisilagiActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add
your handling code here:
group.clearSelection();
cmerk.setSelectedIndex(0);
eharga.setText("0");
ebeli.setText("0");
etotal.setText("0");
ediskon.setText("0");
ebayar.setText("0");
}
private void
bkeluarActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add
your handling code here:
int a= JOptionPane.showConfirmDialog(null,"Ingin
Keluar Dari Program","Keterangan"
,JOptionPane.YES_NO_OPTION);
if (a==JOptionPane.YES_OPTION)
System.exit(0);
else
return;
}
void celana()
{
merk=cmerk.getSelectedIndex();
switch(merk)
{
case 1:
harga=10000;
break;
case 2:
harga=11000;
break;
case 3:
harga=12000;
break;
default:
harga=0;
break;
}
eharga.setText(String.valueOf(harga));
}
void kemeja()
{
merk=cmerk.getSelectedIndex();
switch(merk)
{
case 1:
harga=50000;
break;
case 2:
harga=60000;
break;
case 3:
harga=70000;
break;
default:
harga=0;
break;
}
eharga.setText(String.valueOf(harga));
}
kgk ngerti ???
BalasHapus