Deskripsi :
Aplikasi ini bernama aplikasi pemesanan makanan :
“ Food Kantin STMIK ERESHA” dibuat dengan bahasa pemrograman Java.
Aplikasi ini dibuat dengan bantuan Netbeans. Dalam aplikasi ini terdapat menu
utama yang berisi 7 menu paket utama. Apabila kita sudah memilih salah satu
paket menu yang disediakan, selanjutnya kita harus menentukan berapa porsi yang
kita inginkan. Setelah itu akan secara otomatis tampil total harga yang harus
dibayar beserta paket yang dipilih dan porsi yang diinginkan.
Selanjutnya kita diminta memilih apakah akan memesan lagi atau tidak. Jika kita memilih untuk memesan paket makanan lagi, maka aplikasi akan menampilkan kembali menu utama. Apabila kita memilih untuk tidak lagi memesan paket makanan, maka aplikasi akan menampilkan output tulisan berisi ucapan terima kasih.
Selanjutnya kita diminta memilih apakah akan memesan lagi atau tidak. Jika kita memilih untuk memesan paket makanan lagi, maka aplikasi akan menampilkan kembali menu utama. Apabila kita memilih untuk tidak lagi memesan paket makanan, maka aplikasi akan menampilkan output tulisan berisi ucapan terima kasih.
Komponen/Variabel
:
-
Pilihan
Menu Makanan
-
JTextField
-
Button
-
Jumlah
Harga
-
Integer
-
If
-
Else
-
Swing
-
Jframe
Rumus :
Hargasatuan*jumlahbeli
Flowchart :
Screen Shoot :
Source :
/*
* 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.
*/
/**
*
* @author STMIK Eresha
*/
public class food extends javax.swing.JFrame {
/**
* Creates new form food
*/
public food() {
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();
kali1 = new
javax.swing.JLabel();
kali2 = new
javax.swing.JLabel();
kali3 = new javax.swing.JLabel();
kali5 = new
javax.swing.JLabel();
Ns1 = new
javax.swing.JRadioButton();
rotbak1 = new
javax.swing.JRadioButton();
pizzamie1 = new
javax.swing.JRadioButton();
csf1 = new
javax.swing.JRadioButton();
sb1 = new
javax.swing.JRadioButton();
kali7 = new
javax.swing.JLabel();
jTextField1 = new
javax.swing.JTextField();
jTextField2 = new
javax.swing.JTextField();
jTextField3 = new
javax.swing.JTextField();
jTextField4 = new
javax.swing.JTextField();
jTextField5 = new
javax.swing.JTextField();
txt1 = new
javax.swing.JTextField();
txt3 = new
javax.swing.JTextField();
txt2 = new
javax.swing.JTextField();
txt4 = new javax.swing.JTextField();
txt5 = new
javax.swing.JTextField();
btnHitung1 = new
javax.swing.JButton();
btnHapus1 = new
javax.swing.JButton();
exite = new
javax.swing.JButton();
bbk1 = new
javax.swing.JRadioButton();
jTextField6 = new javax.swing.JTextField();
kali4 = new
javax.swing.JLabel();
txt6 = new
javax.swing.JTextField();
mm1 = new
javax.swing.JRadioButton();
jTextField7 = new
javax.swing.JTextField();
txt7 = new javax.swing.JTextField();
jLabel9 = new
javax.swing.JLabel();
jLabel11 = new
javax.swing.JLabel();
kali6 = new
javax.swing.JLabel();
jLabel16 = new
javax.swing.JLabel();
jumlah = new
javax.swing.JLabel();
jLabel10 = new
javax.swing.JLabel();
txtjml = new
javax.swing.JTextField();
jLabel12 = new
javax.swing.JLabel();
jMenuBar1 = new
javax.swing.JMenuBar();
jMenu1 = new
javax.swing.JMenu();
jMenu2 = new
javax.swing.JMenu();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
getContentPane().setLayout(null);
jLabel1.setBackground(new java.awt.Color(0, 255, 255));
jLabel1.setFont(new
java.awt.Font("Consolas", 3, 36)); // NOI18N
jLabel1.setForeground(new java.awt.Color(255, 153, 0));
jLabel1.setText("Reasearch Tr(_)e Type");
getContentPane().add(jLabel1);
jLabel1.setBounds(200,
70, 420, 42);
kali1.setFont(new
java.awt.Font("Tahoma", 3, 24)); // NOI18N
kali1.setForeground(new
java.awt.Color(255, 0, 0));
kali1.setText("X");
getContentPane().add(kali1);
kali1.setBounds(350,
160, 30, 29);
kali2.setFont(new
java.awt.Font("Tahoma", 3, 24)); // NOI18N
kali2.setForeground(new
java.awt.Color(255, 0, 0));
kali2.setText("X");
getContentPane().add(kali2);
kali2.setBounds(350,
200, 30, 30);
kali3.setFont(new
java.awt.Font("Tahoma", 3, 24)); // NOI18N
kali3.setForeground(new
java.awt.Color(255, 0, 0));
kali3.setText("X");
getContentPane().add(kali3);
kali3.setBounds(350,
240, 30, 30);
kali5.setFont(new
java.awt.Font("Tahoma", 3, 24)); // NOI18N
kali5.setForeground(new
java.awt.Color(255, 0, 0));
kali5.setText("X");
getContentPane().add(kali5);
kali5.setBounds(350,
324, 30, 20);
Ns1.setBackground(new
java.awt.Color(255, 153, 0));
Ns1.setForeground(new
java.awt.Color(255, 0, 0));
Ns1.setText("Nasi
Goreng");
Ns1.addActionListener(new java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
Ns1ActionPerformed(evt);
}
});
getContentPane().add(Ns1);
Ns1.setBounds(28, 159,
120, 30);
rotbak1.setBackground(new java.awt.Color(255, 153, 0));
rotbak1.setForeground(new java.awt.Color(255, 0, 0));
rotbak1.setText("Roti Bakar");
rotbak1.addActionListener(new java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
rotbak1ActionPerformed(evt);
}
});
getContentPane().add(rotbak1);
rotbak1.setBounds(28,
200, 120, 30);
pizzamie1.setBackground(new java.awt.Color(255, 153, 0));
pizzamie1.setForeground(new java.awt.Color(255, 0, 0));
pizzamie1.setText("Pizza Mie");
pizzamie1.addActionListener(new java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
pizzamie1ActionPerformed(evt);
}
});
getContentPane().add(pizzamie1);
pizzamie1.setBounds(28,
241, 120, 30);
csf1.setBackground(new
java.awt.Color(255, 153, 0));
csf1.setForeground(new
java.awt.Color(255, 0, 0));
csf1.setText("Chicken Steak Fillet");
csf1.addActionListener(new java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
csf1ActionPerformed(evt);
}
});
getContentPane().add(csf1);
csf1.setBounds(28, 282,
120, 30);
sb1.setBackground(new
java.awt.Color(255, 153, 0));
sb1.setForeground(new
java.awt.Color(255, 0, 0));
sb1.setText("Spaghetti Bolognaise");
sb1.addActionListener(new java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
sb1ActionPerformed(evt);
}
});
getContentPane().add(sb1);
sb1.setBounds(28, 323,
125, 30);
kali7.setFont(new
java.awt.Font("Tahoma", 3, 24)); // NOI18N
kali7.setForeground(new
java.awt.Color(255, 0, 0));
kali7.setText("X");
getContentPane().add(kali7);
kali7.setBounds(350,
400, 30, 30);
jTextField1.addActionListener(new java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
jTextField1ActionPerformed(evt);
}
});
getContentPane().add(jTextField1);
jTextField1.setBounds(202, 157, 130, 30);
getContentPane().add(jTextField2);
jTextField2.setBounds(202, 198, 130, 30);
getContentPane().add(jTextField3);
jTextField3.setBounds(202, 239, 130, 30);
getContentPane().add(jTextField4);
jTextField4.setBounds(202, 280, 130, 30);
getContentPane().add(jTextField5);
jTextField5.setBounds(202,
321, 130, 30);
txt1.addActionListener(new java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
txt1ActionPerformed(evt);
}
});
getContentPane().add(txt1);
txt1.setBounds(399,
160, 100, 30);
getContentPane().add(txt3);
txt3.setBounds(399,
240, 100, 30);
txt2.addActionListener(new java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
txt2ActionPerformed(evt);
}
});
getContentPane().add(txt2);
txt2.setBounds(399,
200, 100, 30);
getContentPane().add(txt4);
txt4.setBounds(399,
280, 100, 30);
getContentPane().add(txt5);
txt5.setBounds(399,
320, 100, 30);
btnHitung1.setForeground(new java.awt.Color(255, 0, 0));
btnHitung1.setText("Hitung");
btnHitung1.addActionListener(new java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
btnHitung1ActionPerformed(evt);
}
});
getContentPane().add(btnHitung1);
btnHitung1.setBounds(390,
450, 110, 30);
btnHapus1.setForeground(new
java.awt.Color(255, 0, 0));
btnHapus1.setText("Hapus");
btnHapus1.addActionListener(new java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
btnHapus1ActionPerformed(evt);
}
});
getContentPane().add(btnHapus1);
btnHapus1.setBounds(520,
450, 110, 30);
exite.setForeground(new
java.awt.Color(255, 0, 0));
exite.setText("Exit");
exite.addActionListener(new
java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
exiteActionPerformed(evt);
}
});
getContentPane().add(exite);
exite.setBounds(650,
450, 110, 30);
bbk1.setBackground(new
java.awt.Color(255, 153, 0));
bbk1.setForeground(new
java.awt.Color(255, 0, 0));
bbk1.setText("Beef
Burger King");
bbk1.addActionListener(new java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
bbk1ActionPerformed(evt);
}
});
getContentPane().add(bbk1);
bbk1.setBounds(28, 364,
120, 30);
getContentPane().add(jTextField6);
jTextField6.setBounds(202,
362, 130, 30);
kali4.setFont(new
java.awt.Font("Tahoma", 3, 24)); // NOI18N
kali4.setForeground(new
java.awt.Color(255, 0, 0));
kali4.setText("X");
getContentPane().add(kali4);
kali4.setBounds(350,
280, 30, 30);
getContentPane().add(txt6);
txt6.setBounds(399,
360, 100, 30);
mm1.setBackground(new
java.awt.Color(255, 153, 0));
mm1.setForeground(new
java.awt.Color(255, 0, 0));
mm1.setText("Martabak Mini");
mm1.addActionListener(new java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
mm1ActionPerformed(evt);
}
});
getContentPane().add(mm1);
mm1.setBounds(28, 405, 120, 30);
getContentPane().add(jTextField7);
jTextField7.setBounds(202,
403, 130, 30);
txt7.setToolTipText("");
getContentPane().add(txt7);
txt7.setBounds(399,
400, 100, 30);
jLabel9.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/food 2.jpg"))); //
NOI18N
getContentPane().add(jLabel9);
jLabel9.setBounds(-80,
310, 400, 350);
jLabel11.setBackground(new java.awt.Color(51, 255, 255));
jLabel11.setFont(new
java.awt.Font("Century", 3, 36)); // NOI18N
jLabel11.setForeground(new java.awt.Color(255, 153, 0));
jLabel11.setText("FOOD");
getContentPane().add(jLabel11);
jLabel11.setBounds(350,
30, 120, 40);
kali6.setFont(new
java.awt.Font("Tahoma", 3, 24)); // NOI18N
kali6.setForeground(new
java.awt.Color(255, 0, 0));
kali6.setText("X");
getContentPane().add(kali6);
kali6.setBounds(350,
360, 30, 30);
jLabel16.setIcon(new
javax.swing.ImageIcon("C:\\Users\\Lenovo\\Downloads\\food 4.jpg"));
// NOI18N
getContentPane().add(jLabel16);
jLabel16.setBounds(190,
0, 880, 290);
jumlah.setBackground(new java.awt.Color(0, 255, 255));
jumlah.setFont(new
java.awt.Font("Tahoma", 3, 18)); // NOI18N
jumlah.setForeground(new java.awt.Color(255, 0, 0));
jumlah.setText("Jumlah Harga");
getContentPane().add(jumlah);
jumlah.setBounds(320,
520, 130, 30);
jLabel10.setIcon(new
javax.swing.ImageIcon("C:\\Users\\Lenovo\\Downloads\\food 1.jpg"));
// NOI18N
getContentPane().add(jLabel10);
jLabel10.setBounds(0,
-30, 320, 400);
getContentPane().add(txtjml);
txtjml.setBounds(500,
520, 150, 30);
jLabel12.setIcon(new
javax.swing.ImageIcon("C:\\Users\\Lenovo\\Downloads\\food 6.jpg"));
// NOI18N
getContentPane().add(jLabel12);
jLabel12.setBounds(140,
290, 660, 290);
jMenu1.setBackground(new java.awt.Color(255, 153, 0));
jMenu1.setText("File");
jMenu1.addActionListener(new java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
jMenu1ActionPerformed(evt);
}
});
jMenuBar1.add(jMenu1);
jMenu2.setBackground(new java.awt.Color(255, 153, 0));
jMenu2.setText("Edit");
jMenuBar1.add(jMenu2);
setJMenuBar(jMenuBar1);
pack();
}//
</editor-fold>
private void
mm1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your
handling code here:
int MartabakMini=28000;
if (mm1.isSelected()){
jTextField7.setText("" +mm1.getText());
jTextField7.setText(""
+MartabakMini);
}else{
jTextField7.setText("");
}
}
private void
btnHitung1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your
handling code here:
{
int total=0;
int nasi = Integer.parseInt(jTextField1.getText());
int a = Integer.parseInt(txt1.getText());
int hasilnya = nasi*a;
txtjml.setText("Rp."+hasilnya);
}
{
int rotbak = Integer.parseInt(jTextField2.getText());
int b = Integer.parseInt(txt2.getText());
int hasilnya1 =
rotbak*b;
txtjml.setText("Rp."+hasilnya1);
}
{
int pizzamie = Integer.parseInt(jTextField3.getText());
int c = Integer.parseInt(txt3.getText());
int hasilnya2 =
pizzamie*c;
txtjml.setText("Rp."+hasilnya2);
}
{
int ckf =
Integer.parseInt(jTextField4.getText());
int d = Integer.parseInt(txt4.getText());
int hasilnya3 = ckf*d;
txtjml.setText("Rp."+hasilnya3);
}
{
int sb =
Integer.parseInt(jTextField5.getText());
int e = Integer.parseInt(txt5.getText());
int hasilnya4 = sb*e;
txtjml.setText("Rp."+hasilnya4);
}
{
int bk = Integer.parseInt(jTextField6.getText());
int f = Integer.parseInt(txt6.getText());
int hasilnya5 = bk*f;
txtjml.setText("Rp."+hasilnya5);
}
{
int mm =
Integer.parseInt(jTextField7.getText());
int g
= Integer.parseInt(txt7.getText());
int hasilnya6 = mm*g;
txtjml.setText("Rp."+hasilnya6);
}
{
}
}
private void
Ns1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your
handling code here:
{
int NasiGoreng=15000;
if (Ns1.isSelected()){
jTextField1.setText(""
+Ns1.getText());
jTextField1.setText("" +NasiGoreng );
}else{
jTextField1.setText("");
}
}
}
private void
rotbak1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your
handling code here:
int rotibakar=18000;
if
(rotbak1.isSelected()){
jTextField2.setText("" +rotbak1.getText());
jTextField2.setText("" +rotibakar);
}else{
jTextField2.setText("");
}
}
private void
pizzamie1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your
handling code here:
int pizzamie=18000;
if
(pizzamie1.isSelected()){
jTextField3.setText("" +pizzamie1.getText());
jTextField3.setText("" +pizzamie);
}else{
jTextField3.setText("");
}
}
private void
csf1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your
handling code here:
int chickenstikfillet=25000;
if (csf1.isSelected()){
jTextField4.setText("" +csf1.getText());
jTextField4.setText("" +chickenstikfillet);
}else{
jTextField4.setText("");
}
}
private void
sb1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your
handling code here:
int
spaghettibolougnaise=25000;
if (sb1.isSelected()){
jTextField5.setText("" +sb1.getText());
jTextField5.setText("" +spaghettibolougnaise);
}else{
jTextField5.setText("");
}
}
private void
bbk1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your
handling code here:
int BurgerKing=30000;
if (bbk1.isSelected()){
jTextField6.setText("" +bbk1.getText());
jTextField6.setText(""
+BurgerKing);
}else{
jTextField6.setText("");
}
}
private void
txt1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your
handling code here:
}
private void
txt2ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your
handling code here:
}
private void
btnHapus1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your
handling code here:
txt1.setEditable(false);
txt1.setText("");
txt2.setEditable(false);
txt2.setText("");
txt3.setEditable(false);
txt3.setText("");
txt4.setEditable(false);
txt4.setText("");
txt5.setEditable(false);
txt5.setText("");
txt6.setEditable(false);
txt6.setText("");
txt7.setEditable(false);
txt7.setText("");
txtjml.setText("");
}
private void
jMenu1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your
handling code here:
System.exit(0);
}
private void
exiteActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your
handling code here:
this dispose();
}
private void
jTextField1ActionPerformed(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(food.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
} catch
(InstantiationException ex) {
java.util.logging.Logger.getLogger(food.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
} catch
(IllegalAccessException ex) {
java.util.logging.Logger.getLogger(food.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
} catch
(javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(food.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
food().setVisible(true);
}
});
}
// Variables declaration -
do not modify
protected
javax.swing.JRadioButton Ns1;
protected
javax.swing.JRadioButton bbk1;
protected
javax.swing.JButton btnHapus1;
protected
javax.swing.JButton btnHitung1;
protected
javax.swing.JRadioButton csf1;
protected
javax.swing.JButton exite;
protected
javax.swing.JLabel jLabel1;
protected
javax.swing.JLabel jLabel10;
protected
javax.swing.JLabel jLabel11;
protected
javax.swing.JLabel jLabel12;
protected javax.swing.JLabel
jLabel16;
protected
javax.swing.JLabel jLabel9;
protected javax.swing.JMenu
jMenu1;
protected javax.swing.JMenu
jMenu2;
protected
javax.swing.JMenuBar jMenuBar1;
protected
javax.swing.JTextField jTextField1;
protected javax.swing.JTextField
jTextField2;
protected
javax.swing.JTextField jTextField3;
protected
javax.swing.JTextField jTextField4;
protected
javax.swing.JTextField jTextField5;
protected
javax.swing.JTextField jTextField6;
protected javax.swing.JTextField
jTextField7;
protected
javax.swing.JLabel jumlah;
protected
javax.swing.JLabel kali1;
protected
javax.swing.JLabel kali2;
protected
javax.swing.JLabel kali3;
protected
javax.swing.JLabel kali4;
protected javax.swing.JLabel
kali5;
protected
javax.swing.JLabel kali6;
protected
javax.swing.JLabel kali7;
protected
javax.swing.JRadioButton mm1;
protected
javax.swing.JRadioButton pizzamie1;
protected
javax.swing.JRadioButton rotbak1;
protected javax.swing.JRadioButton
sb1;
protected
javax.swing.JTextField txt1;
protected
javax.swing.JTextField txt2;
protected
javax.swing.JTextField txt3;
protected
javax.swing.JTextField txt4;
protected
javax.swing.JTextField txt5;
protected javax.swing.JTextField
txt6;
protected
javax.swing.JTextField txt7;
protected
javax.swing.JTextField txtjml;
// End of variables
declaration
}