Deskripsi :
Aplikasi ini bernama aplikasi pemesanan Ticketing Kereta Api :
“ Ticketing Kereta Api” dibuat dengan bahasa pemrograman Java. Aplikasi
ini dibuat dengan bantuan Netbeans. Dalam aplikasi ini terdapat pilihan tiket
yang berisi 4 pilihan Ticketing. Apabila kita sudah memilih salah satu Pemesanan
ticketing yang disediakan, selanjutnya kita harus menentukan berapa Pemesanan
yang kita inginkan. Setelah itu akan secara otomatis tampil total harga yang
harus dibayar beserta paket yang dipilih dan total Pemesanan yang diinginkan.
Selanjutnya kita diminta memilih apakah akan memesan lagi atau tidak. Jika kita memilih untuk Pemesanan Ticketing, maka aplikasi akan menampilkan kembali menu utama. Apabila kita memilih untuk tidak lagi Pemesanan Ticketing Kereta Api, maka aplikasi akan menampilkan output tulisan berisi ucapan terima kasih.
Selanjutnya kita diminta memilih apakah akan memesan lagi atau tidak. Jika kita memilih untuk Pemesanan Ticketing, maka aplikasi akan menampilkan kembali menu utama. Apabila kita memilih untuk tidak lagi Pemesanan Ticketing Kereta Api, maka aplikasi akan menampilkan output tulisan berisi ucapan terima kasih.
Komponen/Variabel
:
-
Pilihan
Ticketing
-
JTextField
-
Button
-
Jumlah
Harga
-
Integer
-
If
-
Else
-
Swing
-
Jframe
Rumus :
Hargasatuan*jumlahbeli
Flowchart :
Screen Shoot :
Source :
package Program_Ticket;
/**
*
* @author STMIK Eresha
*/
public class
Frame_penjualan_tiket extends javax.swing.JFrame {
/**
* Creates new form Frame_penjualan_tiket
*/
public Frame_penjualan_tiket() {
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();
jLabel3 = new javax.swing.JLabel();
Ekonomi = new
javax.swing.JRadioButton();
EkonomiKomersial = new
javax.swing.JRadioButton();
Bisnis = new
javax.swing.JRadioButton();
Eksekutif = new
javax.swing.JRadioButton();
jLabel4 = new javax.swing.JLabel();
btnprosses = new javax.swing.JButton();
btnhapus = new javax.swing.JButton();
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
jLabel9 = new javax.swing.JLabel();
jDesktopPane1 = new
javax.swing.JDesktopPane();
NoTiket = new javax.swing.JTextField();
jLabel2 = new javax.swing.JLabel();
totalbayar = new
javax.swing.JTextField();
Jumlahbeli = new
javax.swing.JTextField();
jLabel5 = new javax.swing.JLabel();
Hargasatuan = new javax.swing.JTextField();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
getContentPane().setLayout(null);
jLabel1.setFont(new
java.awt.Font("Tahoma", 1, 24)); // NOI18N
jLabel1.setForeground(new
java.awt.Color(102, 153, 255));
jLabel1.setText("Program Sederhana
");
getContentPane().add(jLabel1);
jLabel1.setBounds(150, 0, 320, 40);
jLabel3.setFont(new
java.awt.Font("Times New Roman", 3, 18)); // NOI18N
jLabel3.setForeground(new
java.awt.Color(0, 255, 255));
jLabel3.setText("Jenis
Tiket");
getContentPane().add(jLabel3);
jLabel3.setBounds(10, 180, 90, 30);
Ekonomi.setFont(new
java.awt.Font("Times New Roman", 3, 18)); // NOI18N
Ekonomi.setForeground(new
java.awt.Color(0, 255, 255));
Ekonomi.setText("Ekonomi");
Ekonomi.addActionListener(new
java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
EkonomiActionPerformed(evt);
}
});
getContentPane().add(Ekonomi);
Ekonomi.setBounds(137, 176, 120, 40);
EkonomiKomersial.setFont(new
java.awt.Font("Times New Roman", 3, 18)); // NOI18N
EkonomiKomersial.setForeground(new
java.awt.Color(0, 255, 255));
EkonomiKomersial.setText("Ekonomi
Komersial");
EkonomiKomersial.addActionListener(new
java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
EkonomiKomersialActionPerformed(evt);
}
});
getContentPane().add(EkonomiKomersial);
EkonomiKomersial.setBounds(295, 176,
180, 40);
Bisnis.setFont(new
java.awt.Font("Times New Roman", 3, 18)); // NOI18N
Bisnis.setForeground(new
java.awt.Color(0, 255, 255));
Bisnis.setText("Bisnis");
Bisnis.addActionListener(new
java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
BisnisActionPerformed(evt);
}
});
getContentPane().add(Bisnis);
Bisnis.setBounds(137, 219, 120, 40);
Eksekutif.setFont(new
java.awt.Font("Times New Roman", 3, 18)); // NOI18N
Eksekutif.setForeground(new
java.awt.Color(0, 255, 255));
Eksekutif.setText("Eksekutif");
Eksekutif.addActionListener(new
java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
EksekutifActionPerformed(evt);
}
});
getContentPane().add(Eksekutif);
Eksekutif.setBounds(295, 221, 110, 40);
jLabel4.setFont(new
java.awt.Font("Times New Roman", 3, 18)); // NOI18N
jLabel4.setForeground(new
java.awt.Color(0, 255, 255));
jLabel4.setText("Harga
satuan");
getContentPane().add(jLabel4);
jLabel4.setBounds(10, 267, 120, 40);
btnprosses.setFont(new
java.awt.Font("Tahoma", 1, 14)); // NOI18N
btnprosses.setForeground(new
java.awt.Color(255, 0, 0));
btnprosses.setText("prosses");
btnprosses.addActionListener(new
java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
btnprossesActionPerformed(evt);
}
});
getContentPane().add(btnprosses);
btnprosses.setBounds(150, 370, 85, 40);
btnhapus.setFont(new
java.awt.Font("Tahoma", 1, 14)); // NOI18N
btnhapus.setForeground(new
java.awt.Color(255, 0, 0));
btnhapus.setText("hapus");
btnhapus.addActionListener(new
java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
btnhapusActionPerformed(evt);
}
});
getContentPane().add(btnhapus);
btnhapus.setBounds(270, 370, 75, 40);
jLabel6.setFont(new
java.awt.Font("Times New Roman", 3, 18)); // NOI18N
jLabel6.setForeground(new
java.awt.Color(0, 255, 255));
jLabel6.setText("Total
Bayar");
getContentPane().add(jLabel6);
jLabel6.setBounds(10, 440, 100, 40);
jLabel7.setIcon(new
javax.swing.ImageIcon("C:\\Users\\Lenovo\\Downloads\\ticket.jpg"));
// NOI18N
getContentPane().add(jLabel7);
jLabel7.setBounds(0, 0, 302, 120);
jLabel8.setIcon(new
javax.swing.ImageIcon("C:\\Users\\Lenovo\\Downloads\\ticket.jpg"));
// NOI18N
getContentPane().add(jLabel8);
jLabel8.setBounds(160, 0, 310, 120);
jLabel9.setIcon(new
javax.swing.ImageIcon("C:\\Users\\Lenovo\\Downloads\\ticket.jpg"));
// NOI18N
getContentPane().add(jLabel9);
jLabel9.setBounds(460, 0, 320, 120);
jDesktopPane1.setBackground(new
java.awt.Color(153, 204, 255));
jDesktopPane1.setBorder(new
javax.swing.border.MatteBorder(null));
NoTiket.addActionListener(new
java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent
evt) {
NoTiketActionPerformed(evt);
}
});
jDesktopPane1.add(NoTiket);
NoTiket.setBounds(140, 10, 237, 40);
jLabel2.setFont(new
java.awt.Font("Times New Roman", 3, 18)); // NOI18N
jLabel2.setForeground(new
java.awt.Color(0, 255, 255));
jLabel2.setText("No tiket");
jDesktopPane1.add(jLabel2);
jLabel2.setBounds(20, 10, 70, 30);
totalbayar.addActionListener(new
java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
totalbayarActionPerformed(evt);
}
});
jDesktopPane1.add(totalbayar);
totalbayar.setBounds(140, 320, 250,
40);
Jumlahbeli.addActionListener(new
java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
JumlahbeliActionPerformed(evt);
}
});
jDesktopPane1.add(Jumlahbeli);
Jumlahbeli.setBounds(140, 200, 250,
40);
jLabel5.setFont(new
java.awt.Font("Times New Roman", 3, 18)); // NOI18N
jLabel5.setForeground(new
java.awt.Color(0, 255, 255));
jLabel5.setText("Jumlah
Beli");
jDesktopPane1.add(jLabel5);
jLabel5.setBounds(20, 200, 100, 40);
Hargasatuan.addActionListener(new
java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
HargasatuanActionPerformed(evt);
}
});
jDesktopPane1.add(Hargasatuan);
Hargasatuan.setBounds(140, 150, 250,
40);
getContentPane().add(jDesktopPane1);
jDesktopPane1.setBounds(-10, 120, 770,
420);
pack();
}// </editor-fold>
private void
NoTiketActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void
EkonomiActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
Hargasatuan.setText("25000");
}
private void
EkonomiKomersialActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
Hargasatuan.setText("50000");
}
private void
BisnisActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
Hargasatuan.setText("Rp.100.000");
}
private void
EksekutifActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
Hargasatuan.setText("150000");
}
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("");
Ekonomi.setSelected(false);
Bisnis.setSelected(false);
Eksekutif.setSelected(false);
Ekonomi.setEnabled(true);
Bisnis.setEnabled(true);
Eksekutif.setEnabled(true);
}
private void
HargasatuanActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void
totalbayarActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void
JumlahbeliActionPerformed(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(Frame_penjualan_tiket.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Frame_penjualan_tiket.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Frame_penjualan_tiket.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
} catch
(javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Frame_penjualan_tiket.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
Frame_penjualan_tiket().setVisible(true);
}
});
}
// Variables declaration - do not
modify
private javax.swing.JRadioButton Bisnis;
private javax.swing.JRadioButton Ekonomi;
private javax.swing.JRadioButton
EkonomiKomersial;
private javax.swing.JRadioButton Eksekutif;
private javax.swing.JTextField Hargasatuan;
private javax.swing.JTextField Jumlahbeli;
private javax.swing.JTextField NoTiket;
private javax.swing.JButton btnhapus;
private javax.swing.JButton btnprosses;
private javax.swing.JDesktopPane
jDesktopPane1;
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.JTextField totalbayar;
// End of variables declaration
}


Tidak ada komentar:
Posting Komentar