PROGRAM NETBEANS JAVA
Cekidooottt..
1.DESKRIPSI
Saya akan mendeskripsikan program sederhana penjualan tiket seagames contohnya pertandingan INDONESIA VS BRAZIL. ya walapun belum pernah tapi semoga aja kan indonesia masuk piala dunia . hehehe amin.
berikut tiket yg tersedia beserta harga nya
a.TIKET TRIBUN UTARA 120.000k
b.TIKET TRIUN SELATAN 150.000k
c.TIKET VIP GOLD 200.000k
d.TIKET VIP PLATINUM 250.000k
2.KOMPONEN
a. No TIKET
b. Jenis Tiket
c.Harga Satuan
d>prosses
e>Total Bayar
e>Total Bayar
3.FLOWCHART
4.SOURCE CODE | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package penjualan.tiket.bola.seagames; /** * * @author Mr.Rohmad */ public class Tiket_bola_seagames extends javax.swing.JFrame { /** * Creates new form Tiket_bola_seagames */ public Tiket_bola_seagames() { 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") // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() { jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); NoTiket = new javax.swing.JTextField(); jLabel3 = new javax.swing.JLabel(); tribunutara = new javax.swing.JRadioButton(); tribunselatan = new javax.swing.JRadioButton(); vipgold = new javax.swing.JRadioButton(); vipplatinum = new javax.swing.JRadioButton(); jLabel4 = new javax.swing.JLabel(); hargasatuan = new javax.swing.JTextField(); jLabel5 = new javax.swing.JLabel(); jumlahbeli = new javax.swing.JTextField(); btnprosses = new javax.swing.JButton(); btnhapus = new javax.swing.JButton(); jLabel6 = new javax.swing.JLabel(); totalbayar = new javax.swing.JTextField(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jLabel1.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jLabel1.setText("Program Tiket Bola Seagames INDONESIA VS BRAZIL"); jLabel2.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jLabel2.setText("No Tiket"); jLabel3.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jLabel3.setText("Jenis Tiket"); tribunutara.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N tribunutara.setText("Tribun Utara"); tribunutara.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { tribunutaraActionPerformed(evt); } }); tribunselatan.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N tribunselatan.setText("Tribun Selatan"); tribunselatan.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { tribunselatanActionPerformed(evt); } }); vipgold.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N vipgold.setText("VIP GOLD"); vipgold.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { vipgoldActionPerformed(evt); } }); vipplatinum.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N vipplatinum.setText("VIP PLATINUM"); vipplatinum.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { vipplatinumActionPerformed(evt); } }); jLabel4.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jLabel4.setText("Harga Satuan"); jLabel5.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jLabel5.setText("Jumlah Beli"); btnprosses.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N btnprosses.setText("prosses"); btnprosses.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnprossesActionPerformed(evt); } }); btnhapus.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N btnhapus.setText("hapus"); btnhapus.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnhapusActionPerformed(evt); } }); jLabel6.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jLabel6.setText("Total Bayar"); totalbayar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { totalbayarActionPerformed(evt); } }); 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() .addGap(40, 40, 40) .addComponent(jLabel1)) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() .addComponent(jLabel2) .addGap(31, 31, 31) .addComponent(NoTiket, javax.swing.GroupLayout.PREFERRED_SIZE, 248, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() .addComponent(jLabel3) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(tribunutara) .addComponent(vipgold)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(vipplatinum) .addComponent(tribunselatan))))) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel4) .addComponent(jLabel5) .addComponent(jLabel6)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(layout.createSequentialGroup() .addComponent(btnprosses) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 72, Short.MAX_VALUE) .addComponent(btnhapus)) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(hargasatuan) .addComponent(jumlahbeli, javax.swing.GroupLayout.DEFAULT_SIZE, 212, Short.MAX_VALUE)) .addComponent(totalbayar)))) .addContainerGap(65, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(23, 23, 23) .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2) .addComponent(NoTiket, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(28, 28, 28) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel3) .addComponent(tribunutara) .addComponent(tribunselatan)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(vipgold) .addComponent(vipplatinum)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel4) .addComponent(hargasatuan, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(24, 24, 24) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel5) .addComponent(jumlahbeli, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(btnprosses) .addComponent(btnhapus)) .addGap(40, 40, 40) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel6) .addComponent(totalbayar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(87, Short.MAX_VALUE)) ); pack(); }// </editor-fold> private void tribunutaraActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: hargasatuan.setText ("120000"); } private void tribunselatanActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: hargasatuan.setText ("150000"); } private void vipgoldActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: hargasatuan.setText ("200000"); } private void vipplatinumActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: hargasatuan.setText ("250000"); } private void btnprossesActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: int c = Integer.parseInt(hargasatuan.getText()); int d = Integer.parseInt(jumlahbeli.getText()); int hasilnya = c*d; totalbayar.setText("Rp."+hasilnya); } private void btnhapusActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: NoTiket.setText(""); jumlahbeli.setText(""); hargasatuan.setText(""); totalbayar.setText(""); tribunutara.setSelected(false); tribunselatan.setSelected(false); vipgold.setSelected(false); vipplatinum.setSelected(false); tribunutara.setEnabled(true); tribunselatan.setEnabled(true); vipgold.setEnabled(true); vipplatinum.setEnabled(true); } private void totalbayarActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: } /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* 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(Tiket_bola_seagames.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Tiket_bola_seagames.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Tiket_bola_seagames.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Tiket_bola_seagames.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new Tiket_bola_seagames().setVisible(true); } }); } // Variables declaration - do not modify private javax.swing.JTextField NoTiket; private javax.swing.JButton btnhapus; private javax.swing.JButton btnprosses; private javax.swing.JTextField hargasatuan; 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.JTextField jumlahbeli; private javax.swing.JTextField totalbayar; private javax.swing.JRadioButton tribunselatan; private javax.swing.JRadioButton tribunutara; private javax.swing.JRadioButton vipgold; private javax.swing.JRadioButton vipplatinum; // End of variables declaration } 5.HASIL RUN |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Penjelasan ; 1.kalian masuk ke program 2.kalian masukan nomor tiket, jenistiket, jumlah tiket. 3.klik prosses 4.akan keluar hasil harga jumlah tiket 5.selesai. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||