THOUSANDS OF FREE BLOGGER TEMPLATES

Sabtu, 05 November 2011

tugas java 4

import javax.swing.JOptionPane;

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

/*
* Kliniknuri.java
*
* Created on Nov 1, 2011, 7:03:21 PM
*/
/**
*
*
* @author icam
*/
public class Kliniknuri extends javax.swing.JFrame {

/** Creates new form Kliniknuri */
double harga, biaya, adm, resep, obat, total, potongan, totalbayar=0;
public Kliniknuri() {
initComponents();
}

/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// //GEN-BEGIN:initComponents
private void initComponents() {

jPanel1 = new javax.swing.JPanel();
jLabel_kode_kamar = new javax.swing.JLabel();
jLabel_nama_kamar = new javax.swing.JLabel();
jLabel_jenis = new javax.swing.JLabel();
jLabel_harga = new javax.swing.JLabel();
ckodekamar = new javax.swing.JComboBox();
tnamakamar = new javax.swing.JTextField();
rjenisvip = new javax.swing.JRadioButton();
rjeniskelas = new javax.swing.JRadioButton();
tharga = new javax.swing.JTextField();
jPanel2 = new javax.swing.JPanel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
ckodedokter = new javax.swing.JComboBox();
tnamadokter = new javax.swing.JTextField();
rwaktupagi = new javax.swing.JRadioButton();
rwaktusore = new javax.swing.JRadioButton();
tbiayakonsultasi = new javax.swing.JTextField();
jLabel1 = new javax.swing.JLabel();
jPanel3 = new javax.swing.JPanel();
cbadm = new javax.swing.JCheckBox();
cbresep = new javax.swing.JCheckBox();
cbobat = new javax.swing.JCheckBox();
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
jLabel9 = new javax.swing.JLabel();
tadm = new javax.swing.JTextField();
tresep = new javax.swing.JTextField();
tobat = new javax.swing.JTextField();
ttotal = new javax.swing.JTextField();
tpotongan = new javax.swing.JTextField();
ttotalbayar = new javax.swing.JTextField();
bbersih = new javax.swing.JButton();
bkeluar = new javax.swing.JButton();
ccarabayar = new javax.swing.JComboBox();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowOpened(java.awt.event.WindowEvent evt) {
formWindowOpened(evt);
}
});

jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Data Rawat Inap"));
jPanel1.setToolTipText("");
jPanel1.setFocusCycleRoot(true);
jPanel1.setFont(new java.awt.Font("Tahoma", 0, 12));
jPanel1.setName("jpanel1"); // NOI18N

jLabel_kode_kamar.setText("Kode Kamar");

jLabel_nama_kamar.setText("Nama Kamar");

jLabel_jenis.setText("Jenis");

jLabel_harga.setText("Harga");

ckodekamar.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "-= Pilih =-", "MW", "BG" }));
ckodekamar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
ckodekamarActionPerformed(evt);
}
});

tnamakamar.setText("jTextField1");

rjenisvip.setText("VIP");
rjenisvip.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
rjenisvipActionPerformed(evt);
}
});

rjeniskelas.setText("Kelas 1");
rjeniskelas.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
rjeniskelasActionPerformed(evt);
}
});

tharga.setText("jTextField2");

javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel_kode_kamar)
.addComponent(jLabel_nama_kamar))
.addGap(25, 25, 25)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(tnamakamar)
.addComponent(ckodekamar, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(tharga, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel_jenis)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(rjenisvip)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(rjeniskelas))
.addComponent(jLabel_harga))
.addContainerGap())
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel_kode_kamar)
.addComponent(ckodekamar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel_nama_kamar)
.addComponent(tnamakamar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel_jenis)
.addComponent(rjeniskelas)
.addComponent(rjenisvip))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel_harga)
.addComponent(tharga, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap())
);

jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Data Dokter"));

jLabel2.setText("Kode Dokter");

jLabel3.setText("Nama Dokter");

jLabel4.setText("Waktu Praktek");

jLabel5.setText("Biaya Konsultasi");

ckodedokter.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "-= Pilih =-", "KM", "SY" }));
ckodedokter.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
ckodedokterActionPerformed(evt);
}
});

tnamadokter.setText("jTextField1");

rwaktupagi.setText("Pagi");
rwaktupagi.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
rwaktupagiActionPerformed(evt);
}
});

rwaktusore.setText("Sore");
rwaktusore.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
rwaktusoreActionPerformed(evt);
}
});

tbiayakonsultasi.setText("jTextField2");

javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel5)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2)
.addComponent(jLabel3)
.addComponent(jLabel4))
.addGap(28, 28, 28)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(rwaktupagi)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(rwaktusore))
.addComponent(ckodedokter, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(tnamadokter)
.addComponent(tbiayakonsultasi))))
.addContainerGap())
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(ckodedokter, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(tnamadokter, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel4)
.addComponent(rwaktupagi)
.addComponent(rwaktusore))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel5)
.addComponent(tbiayakonsultasi, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap())
);

jLabel1.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
jLabel1.setText("APLIKASI KLINIK \"NURI\"");

jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Data Pembayaran"));

cbadm.setText("ADM");
cbadm.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cbadmActionPerformed(evt);
}
});

cbresep.setText("Resep");
cbresep.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cbresepActionPerformed(evt);
}
});

cbobat.setText("Obat");
cbobat.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cbobatActionPerformed(evt);
}
});

jLabel6.setText("Cara Bayar");

jLabel7.setText("Total");

jLabel8.setText("Potongan");

jLabel9.setText("Total Bayar");

tadm.setText("jTextField3");

tresep.setText("jTextField4");

tobat.setText("jTextField5");

bbersih.setText("Bersih");
bbersih.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
bbersihActionPerformed(evt);
}
});

bkeluar.setText("Keluar");
bkeluar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
bkeluarActionPerformed(evt);
}
});

ccarabayar.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "-= Pilih =-", "Cash", "Transfer" }));
ccarabayar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
ccarabayarActionPerformed(evt);
}
});

javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(cbadm)
.addComponent(cbresep)
.addComponent(cbobat)
.addComponent(jLabel6)
.addComponent(jLabel7)
.addComponent(jLabel8)
.addComponent(jLabel9))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 28, Short.MAX_VALUE)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(ccarabayar, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(ttotalbayar)
.addComponent(tpotongan)
.addComponent(ttotal)
.addComponent(tobat)
.addComponent(tresep)
.addComponent(tadm, javax.swing.GroupLayout.DEFAULT_SIZE, 93, Short.MAX_VALUE)))
.addGroup(jPanel3Layout.createSequentialGroup()
.addComponent(bbersih)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 52, Short.MAX_VALUE)
.addComponent(bkeluar)))
.addContainerGap())
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(cbadm)
.addComponent(tadm, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(cbresep)
.addComponent(tresep, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(cbobat)
.addComponent(tobat, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel6)
.addComponent(ccarabayar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel7)
.addComponent(ttotal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel8)
.addComponent(tpotongan, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel9)
.addComponent(ttotalbayar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(bbersih)
.addComponent(bkeluar))
.addContainerGap(37, Short.MAX_VALUE))
);

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(jPanel2, javax.swing.GroupLayout.Alignment.LEADING, 0, 0, Short.MAX_VALUE)
.addComponent(jPanel1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(119, 119, 119)
.addComponent(jLabel1)))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jPanel3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap())
);

pack();
}// //GEN-END:initComponents

private void cbadmActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbadmActionPerformed
// TODO add your handling code here:
adm = 10000;
tadm.setText(String.valueOf((int)adm));
}//GEN-LAST:event_cbadmActionPerformed

private void bbersihActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bbersihActionPerformed
// TODO add your handling code here:
ckodekamar.setSelectedIndex(0);
tnamakamar.setText("");
rjenisvip.setSelected(false);
rjeniskelas.setSelected(false);
tharga.setText("");
ckodedokter.setSelectedIndex(0);
tnamadokter.setText("");
rwaktupagi.setSelected(false);
rwaktusore.setSelected(false);
tbiayakonsultasi.setText("");
cbadm.setContentAreaFilled(false);
cbresep.setContentAreaFilled(false);
cbobat.setContentAreaFilled(false);
tadm.setText("");
tresep.setText("");
tobat.setText("");
ccarabayar.setSelectedIndex(0);
ttotal.setText("");
tpotongan.setText("");
ttotalbayar.setText("");
}//GEN-LAST:event_bbersihActionPerformed

private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowOpened
// TODO add your handling code here:
this.setTitle("Aplikasi Klinik NURI");
bbersih.setMnemonic('B');
bkeluar.setMnemonic('K');
ckodekamar.setSelectedIndex(0);
tnamakamar.setText("");
rjenisvip.setSelected(false);
rjeniskelas.setSelected(false);
tharga.setText("");
ckodedokter.setSelectedIndex(0);
tnamadokter.setText("");
rwaktupagi.setSelected(false);
rwaktusore.setSelected(false);
tbiayakonsultasi.setText("");
cbadm.setContentAreaFilled(false);
cbresep.setContentAreaFilled(false);
cbobat.setContentAreaFilled(false);
tadm.setText("");
tresep.setText("");
tobat.setText("");
ccarabayar.setSelectedIndex(0);
ttotal.setText("");
tpotongan.setText("");
ttotalbayar.setText("");
}//GEN-LAST:event_formWindowOpened

private void ckodekamarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ckodekamarActionPerformed
// TODO add your handling code here:
if (ckodekamar.getSelectedItem().toString().equalsIgnoreCase("MW"))
tnamakamar.setText("Mawar");
else
tnamakamar.setText("Bougenville");
}//GEN-LAST:event_ckodekamarActionPerformed

private void bkeluarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bkeluarActionPerformed
// TODO add your handling code here:
int keluar = JOptionPane.showConfirmDialog(null, "Yakin Ingin Keluar ?", "Pertanyaan", JOptionPane.YES_NO_OPTION);
if (keluar==0)
{
System.exit(0);
}
else
{
return;
}
}//GEN-LAST:event_bkeluarActionPerformed

private void rjenisvipActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rjenisvipActionPerformed
// TODO add your handling code here:
rjenisvip.setSelected(true);
rjeniskelas.setSelected(false);
harga = 300000;
tharga.setText(String.valueOf((int)harga));
}//GEN-LAST:event_rjenisvipActionPerformed

private void rjeniskelasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rjeniskelasActionPerformed
// TODO add your handling code here:
rjenisvip.setSelected(false);
rjeniskelas.setSelected(true);
harga = 200000;
tharga.setText(String.valueOf((int)harga));
}//GEN-LAST:event_rjeniskelasActionPerformed

private void ckodedokterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ckodedokterActionPerformed
// TODO add your handling code here:
if (ckodedokter.getSelectedItem().toString().equalsIgnoreCase("KM"))
tnamadokter.setText("Khanza");
else
tnamadokter.setText("Syahniah");
}//GEN-LAST:event_ckodedokterActionPerformed

private void rwaktupagiActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rwaktupagiActionPerformed
// TODO add your handling code here:
rwaktupagi.setSelected(true);
rwaktusore.setSelected(false);
biaya = 50000;
tbiayakonsultasi.setText(String.valueOf((int)biaya));
}//GEN-LAST:event_rwaktupagiActionPerformed

private void rwaktusoreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rwaktusoreActionPerformed
// TODO add your handling code here:
rwaktupagi.setSelected(false);
rwaktusore.setSelected(true);
biaya = 100000;
tbiayakonsultasi.setText(String.valueOf((int)biaya));

}//GEN-LAST:event_rwaktusoreActionPerformed

private void cbresepActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbresepActionPerformed
// TODO add your handling code here:
resep = 10000;
tresep.setText(String.valueOf((int)resep));
}//GEN-LAST:event_cbresepActionPerformed

private void cbobatActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbobatActionPerformed
// TODO add your handling code here:
obat = 5000;
tobat.setText(String.valueOf((int)obat));
}//GEN-LAST:event_cbobatActionPerformed

private void ccarabayarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ccarabayarActionPerformed
// TODO add your handling code here:
total = harga + biaya + adm + resep + obat;
ttotal.setText(String.valueOf((int)total));
if (ccarabayar.getSelectedItem().toString().equalsIgnoreCase("CASH"))
{
potongan = total * 0.5;
tpotongan.setText(String.valueOf(potongan));
totalbayar = total - potongan;
ttotalbayar.setText(String.valueOf((int)totalbayar));
}
else
{
potongan = total * 0.1;
tpotongan.setText(String.valueOf(potongan));
totalbayar = total - potongan;
ttotalbayar.setText(String.valueOf((int)totalbayar));
}
}//GEN-LAST:event_ccarabayarActionPerformed

/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(Kliniknuri.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Kliniknuri.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Kliniknuri.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Kliniknuri.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//

/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {

public void run() {
new Kliniknuri().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton bbersih;
private javax.swing.JButton bkeluar;
private javax.swing.JCheckBox cbadm;
private javax.swing.JCheckBox cbobat;
private javax.swing.JCheckBox cbresep;
private javax.swing.JComboBox ccarabayar;
private javax.swing.JComboBox ckodedokter;
private javax.swing.JComboBox ckodekamar;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JLabel jLabel_harga;
private javax.swing.JLabel jLabel_jenis;
private javax.swing.JLabel jLabel_kode_kamar;
private javax.swing.JLabel jLabel_nama_kamar;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JRadioButton rjeniskelas;
private javax.swing.JRadioButton rjenisvip;
private javax.swing.JRadioButton rwaktupagi;
private javax.swing.JRadioButton rwaktusore;
private javax.swing.JTextField tadm;
private javax.swing.JTextField tbiayakonsultasi;
private javax.swing.JTextField tharga;
private javax.swing.JTextField tnamadokter;
private javax.swing.JTextField tnamakamar;
private javax.swing.JTextField tobat;
private javax.swing.JTextField tpotongan;
private javax.swing.JTextField tresep;
private javax.swing.JTextField ttotal;
private javax.swing.JTextField ttotalbayar;
// End of variables declaration//GEN-END:variables
}

Jumat, 06 November 2009

Artikel Pemrograman Terstruktur

Pemrograman Terstruktur

adalah suatu aktifitas pemrograman dengan memperhatikan urutan langkah-langkah perintah secara sistematis, logis , dan tersusun berdasarkan algoritma yang sederhana dan mudah dipahami. Dipelopori pertama kali oleh Professor Edsger Djikstra, PemrogramanTerstruktur mulai berkembang dengan suatu teori yang melemahkan penggunaan statement Go To pada suatu program. Selain memakan (relatif) banyak memori, penggunaan Go To membuat suatu alur penyelesaian masalah menjadi kurang efisien karena urutan penyelesaian menjadi tidak terurut dan cenderung menjadi rumit.

Pemrograman terstruktur memiliki tujuan antara lain untuk lebih mudah memahami suatu program dengan demikian faktor error dapat ditemukan dengan cepat. Selain itu tujuan dari pemrograman terstruktur untuk mempermudah menganalisis dan memodifikasi program, meningkatkan kehandalan program, menyederhanakan kompleksitas program, dan memudahkan pemeliharaan program serta peningkatan kualitas program.

Sifat-sifat dari pemrograman terstruktur dapat diuraikan sebagai berikut :
a. Memuat teknik pemecahan masalah yang logis dan sistematis
b. Memuat algoritma yang efisien, efektif dan sederhana
c. Program disusun dengan logika yang mudah dipahami
d. Tidak menggunakan perintah GOTO
e. Biaya pengujian program relatif rendah
f. Memiliki dokumentasi yang baik
g. Biaya perawatan dan dokumentasi yang dbuthkan relatif rendah

Pemrograman berorientasi obyek menjalankan fungsinya secara berbeda dengan pemrograman terstruktur. Pemrograman berorientasi objek membutuhkan strategi pemrograman baru yang seringkali sulit untuk programmer yang berorientasi pada pemrograman terstruktur. Dalam pemrograman berorientasi obyek, obyek tidak hanya menyimpan data (data anggota) namun juga metoda (fungsi anggota) untuk mengerjakan sesuatu pada data tersebut. Dua item ini terpadukan dalam suatu konsep kerja: obyek berisi data dan metode untuk melakukan sesuatu pada data tersebut.

Sekarang ini, programmer lebih banyak menggunakan pemrograman berorientasi objek daripada pemrograman terstruktur.Mengapa bisa demikian?Hal ini disebabkan karena untuk membuat program-program yang lebih rumit dan kompleks, pemrograman berorientasi objek lebih praktis dibandingkan dengan pemrograman terstruktur.Akan tetapi, untuk program-program yang relatif masih sederhana, pemrograman terstruktur lebih bagus digunakan karena lebih simple dan mudah.