Ketentuan Soal :
A. Lokasi dan Harga
1. Blok A = Rp.2,000,000
2. Blok B = Rp.3,000,000
3. Blok C = Rp.4,000,000
B. Fasilitas dan Biaya
1. Jogging Track = Rp. 100,000
2. Swimming Pool = Rp. 200,000
3. Gymnasium = Rp. 300,000
C. Cara Pembayaran
1. Bank Mandiri = Rp. 10,000
2. Other Bank = Rp. 50,000
Source Code :
import javax.swing.JOptionPane;
public class FAPPRUMAH.....bla,... bla,.. bla,...
int hrgdasar, jog, swim, gym, bayar, total;
-------------------------------------------------------------------------------------------
- Combo Box :
if(combo.getSelectedItem().equals("Blok A")){
vhrg = 2000000;
vtotal = vhrg + vjog + vswim + vgym + vbayar;
jhrg.setText(String.valueOf(vhrg));
jtotal.setText(String.valueOf(vtotal));
}
else if(combo.getSelectedItem().equals("Blok B")){
vhrg = 3000000;
vtotal = vhrg + vjog + vswim + vgym + vbayar;
jhrg.setText(String.valueOf(vhrg));
jtotal.setText(String.valueOf(vtotal));
}
else if(combo.getSelectedItem().equals("Blok C")){
vhrg = 4000000;
vtotal = vhrg + vjog + vswim + vgym + vbayar;
jhrg.setText(String.valueOf(vhrg));
jtotal.setText(String.valueOf(vtotal));
}
else{
vhrg = 0;
vtotal = vhrg + vjog + vswim + vgym + vbayar;
jhrg.setText(String.valueOf(vhrg));
jtotal.setText(String.valueOf(vtotal));
}
}
- Check Box Jogging :
if(check1.isSelected()){
vjog = 100000;
vtotal = vhrg + vjog + vswim + vgym + vbayar;
jog.setText(String.valueOf(vjog));
jtotal.setText(String.valueOf(vtotal));
}
else{
vjog = 0;
vtotal = vhrg + vjog + vswim + vgym + vbayar;
jog.setText(String.valueOf(vjog));
jtotal.setText(String.valueOf(vtotal));
}
- Check Box Swimming Pool :
if(check2.isSelected()){
vjog = 200000;
vtotal = vhrg + vjog + vswim + vgym + vbayar;
swim.setText(String.valueOf(vjog));
jtotal.setText(String.valueOf(vtotal));
}
else{
vjog = 0;
vtotal = vhrg + vjog + vswim + vgym + vbayar;
swim.setText(String.valueOf(vjog));
jtotal.setText(String.valueOf(vtotal));
}
- Check Box Gymnasium :
if(check3.isSelected()){
vjog = 300000;
vtotal = vhrg + vjog + vswim + vgym + vbayar;
gym.setText(String.valueOf(vjog));
jtotal.setText(String.valueOf(vtotal));
}
else{
vjog = 0;
vtotal = vhrg + vjog + vswim + vgym + vbayar;
gym.setText(String.valueOf(vjog));
jtotal.setText(String.valueOf(vtotal));
}
- Radio Button Bank Mandiri :
if(btnmandiri.isSelected()){
vbayar = 10000;
vtotal = vhrg + vjog + vswim + vgym + vbayar;
bayar.setText(String.valueOf(bayar));
jtotal.setText(String.valueOf(vtotal));
}
- Radio Button Other Bank :
if(btnmandiri.isSelected()){
vbayar = 50000;
vtotal = vhrg + vjog + vswim + vgym + vbayar;
bayar.setText(String.valueOf(bayar));
jtotal.setText(String.valueOf(vtotal));
}
- Button Bersih :
vtotal = 0;
vjog = 0;
vswim = 0;
vgym = 0;
vbayar = 0;
combo.setSelectedItem("-- Pilih --");
jhrg.setText("0");
jog.setText("0");
swim.setText("0");
gym.setText("0");
bayar.setText("0");
jtotal.setText("0");
check1.setSelected(false);
check2..setSelected(false);
check3.setSelected(false);
btngrp.clearSelection();
- Button Keluar :
int x=JOptionPane.showConfirmDialog(null,"Yakin Ingin Keluar??","PERTANYAAN",JOptionPane.YES_NO_OPTION);
if(x==JOptionPane.YES_OPTION){
dispose();
}
else{
return;
}
2 comments:
public class hargaRumah extends javax.swing.JFrame {
int vhrg, vjog, vswim, vgym, vbayar, vtotal;
JRadio button tuk bang mandiri & other bank msh kurang po mas settingny?..
ada yang lansung jadi nggak,tolong kirimdalam bentukrar projectnya. husni.mubarak71@gmail.com
Post a Comment