hi everybody
I am currently creating a simulation of a pizza ordering system in object oriented program. I have some question. the instruction and guideline is long but I will try and cut it down a lot. the instruction is to create a program that simulate a pizza restaurant using a GUI it has two bakers and one cashier. both bakers has thier own speciality, if one is absent, the other has to fill in and vice versa according to the orders entered. it also I have to read and process a data file, called pizz_mani_orders.txt to the simulate the operation of the pizza restaurant. also need to compute the salary for each member of staff.
my question is. how do i give the checkboxes, radiobutton and button the functionality it need. this is the codes that i have so far. I am not finish as yet but was wondering if i am going in the right direction. how do i add a checkboxes and radiobuttons and button to a panel
how am I doing so far, am I wrong, right, or in the wrong or right direction. would love you all input.
many thanks in advance
I know that i am not perfect.
package PizzaMania;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import javax.swing.*;
import javax.swing.JFrame;
import javax.swing.JMenuBar;
import javax.swing.event.*;
public class PizzaMania extends javax.swing.JFrame {
private JMenuBar menuBar;
private JMenu File;
private JMenuItem Reset;
private JMenuItem Exit;
private JCheckBox tomato;
private JCheckBox greenpepper;
private JCheckBox blackolives;
private JCheckBox mushrooms;
private JCheckBox extracheese;
private JCheckBox pepperoni;
private JCheckBox sausage;
public PizzaMania(){
super("PizzaMania");
sendMenuBar();
sendUI(this);
}
private void sendMenuBar(){
menuBar = new JMenuBar();
File = new JMenu(" File ");
Reset= new JMenuItem(" Reset");
Exit = new JMenuItem(" exit ");
setJMenuBar(menuBar);
menuBar.add(File);
Exit.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e){
System.exit(0);
}
});
File.add(Reset);//still to be coded
Reset.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e){
}
});
File.add(Exit);
}
private void sendUI(PizzaMania app){
app.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
app.setSize(600, 700);
app.setLayout(null);
app.setLocationRelativeTo(null);
app.setVisible(true);
}
//pizza topping
JCheckBox Tomato = new JCheckBox(" Tomato");
JCheckBox GreenPepper = new JCheckBox(" Green Pepper");
JCheckBox BlackOlives = new JCheckBox(" Black Olives");
JCheckBox Mushrooms = new JCheckBox(" Mushrooms");
JCheckBox ExtraCheese = new JCheckBox(" Extra Cheese");
JCheckBox Pepperoni= new JCheckBox(" Pepperoni");
JCheckBox Sausage = new JCheckBox(" Sausage");
JButton placeorder = new JButton("Place Order");
JButton printallorders = new JButton("Print All Orders");
JTextField CashierName = new JTextField(" Suzanne ");
JTextField BakersName = new JTextField(" Gary ");
JTextField BakerName = new JTextField(" Bishop ");
//pizza size options
JRadioButton Small = new JRadioButton("Samll ");
JRadioButton Medium = new JRadioButton("Medium");
JRadioButton Large = new JRadioButton("Large");
JRadioButton Family = new JRadioButton("Family");
JRadioButton MembersCard = new JRadioButton("Members Card");
//pizza crust choices
JRadioButton ThinCrust = new JRadioButton("Thin Crust");
JRadioButton MediumCrust = new JRadioButton("Medium Crust");
JRadioButton CrustLover= new JRadioButton("Crust Lover");
//get the toppings method
//return the cost of toppings
public int getnumofToppingCost(){
int toppingCost =0;
for(int i=0; i <=7; i++){
if(tomato.isSelected()){
toppingCost +=1;
}
if(greenpepper.isSelected()){
toppingCost +=1;
}
if(blackolives.isSelected()){
toppingCost +=1;
}
if(mushrooms.isSelected()){
toppingCost +=1;
}
if(extracheese.isSelected()){
toppingCost +=1;
}
if(pepperoni.isSelected()){
toppingCost +=1;
}
if(sausage.isSelected()){
toppingCost +=1;
}
}
return toppingCost;
}
//adding radio button to a panel
//get size method
public double getSizeCost(){
double sizeCost =0;
boolean size = true;
return sizeCost;
}