Basic Java Programming Final
Essay by 24 • September 7, 2010 • 2,884 Words (12 Pages) • 2,109 Views
//Import Classes
import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
//Class spacifics for making Dollars and Cents
import java.text.NumberFormat;
//Begin the ATM
public class mcd extends JPanel implements ActionListener,ItemListener
{
//Create Global variables and objects
JButton Start,burger1,burger2,burger3, button, next, addorder, paynow, addedit,removeord,ccpay,capay,
coke, sprite, drp, root,orange,ultra,large,medium,small,amex,visa,mc,atm,back,take,insert;
String totalorder, orders,ord1,ord2,ord3, burg1, burg2, burg3, lett, toma, ketc, must, oni, pick, che,ttprice,
coked,sprited,drpd,rootd,oranged,ultrad,larged,mediumd,smalld,ccnum,s,currencyOut,bill,ammtdue;
JTabbedPane tabbedPane;
JScrollPane panel8bta;
JPanel panel8t, panel8b,panel8bb,panel8bt;
JTextArea welcometxt, order,torders, receipt,bye;
JTextField amtdue;
JCheckBox lettuce, tomatos, ketchup, mustard, onions, pickles, cheese;
int c,l,t,k,m,o,p,ordernum, item,ptype,custnum;
double bprice,sprice,stprice,o1p,o2p,o3p,tprice,currency,amtdu,billa,billb;
//Array to hold the check boxes on condiment selection.
int[][] checks;
//Create GUI
public mcd() {
//Make all variables 0 or equivlent.
billa=0;
billb=0;
c= (-1);
l= -1;
t= -1;
k= -1;
m= -1;
o= -1;
p= -1;
burg1="";
burg2="";
burg3="";
lett="";
toma="";
ketc="";
must="";
oni="";
pick="";
che="";
orders="";
ultrad = "";
larged = "";
mediumd= "";
smalld = "";
sprited = "";
drpd = "";
rootd = "";
oranged="";
coked="";
checks= new int[3][7];
ordernum=1;
ptype=0;
ord1 = "";
ord2 = "";
ord3 = "";
custnum = custnum+1;
totalorder = "";
//ImageIcon icon = new ImageIcon("dummy.jpg");
//Main Tabbed Pane
tabbedPane = new JTabbedPane();
//Call components, The tabs
//Tab 1
Component panel1 = makePanel1();
tabbedPane.addTab("Welcome",null, panel1, "Welcome");
tabbedPane.setSelectedIndex(0);
//Tab 2
Component panel2 = makePanel2();
tabbedPane.addTab("Burger Choice",null, panel2, "Burgers");
//Tab 3
Component panel3 = makePanel3();
tabbedPane.addTab("Condiments", null, panel3, "Condiments");
//Tab 4
Component panel4 = makePanel4();
tabbedPane.addTab("Drink",null, panel4, "Soda Fountain");
//Tab 5
Component panel5 = makePanel5();
tabbedPane.addTab("Size",null, panel5, "Ultra Size?");
//Tab 6
Component panel6 = makePanel6();
tabbedPane.addTab("Confirm Order",null, panel6, "Confirm order");
//Tab 7
Component panel7 = makePanel7();
tabbedPane.addTab("Pay Now",null, panel7, "Pay Now");
//Component panel8 = makePanel8(); is called later, after the pay now button is pressed
...
...