Question: i need some help in my java GUI burger program so please help me , i want to add picture to be logo at the
i need some help in my java GUI burger program so please help me , i want to add picture to be logo at the top of the program (i will include the picture).and i want to add the details of user of his order with the price before clicking payment so the user can see his order. for example if the user choose classic burger and cola it should like text for his order.
*please help me in this as soon possible with great thanks.
this is the code so you can understand what i mean
import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener;
import javax.swing.*;
interface GUI { static final JFrame frame = new JFrame("Abdulluh Taisir Khalil Darwish - 2019393073"); static final JButton button = new JButton("Make an Order"); static final JLabel menu1 = new JLabel("Menu"); static final JLabel co = new JLabel("Customize Order: "); final String a[] = { "none", "Cola", "Sprite", "Mirinda" }; static final JComboBox co1 = new JComboBox(a); static final JLabel drinks =new JLabel("Drinks : ");
static final JLabel sizeLabel =new JLabel("Size : "); static final JRadioButton regular = new JRadioButton("Regular"); static final JRadioButton large = new JRadioButton("Large"); final String s[] = { "Fish Burger", "Chicken Burger", "Classic Burger", "Double Burger", "Fries" }; final int priceArray[] = {11, 13 ,15 , 18, 10}; static final JComboBox menu = new JComboBox(s); static final JTextField result = new JTextField(); static final JLabel eA=new JLabel("Enter Amount: "); static final JButton makeP = new JButton("Make Payment"); static final JButton total = new JButton("View Total"); static final JLabel totalA = new JLabel("Total Amount:Press Calculate Total"); static final JLabel last=new JLabel("Thanks for Visiting Us..!!");
static final JCheckBox Tomatoes = new JCheckBox("Tomatoes"); static final JCheckBox lettuce = new JCheckBox("lettuce"); static final JCheckBox Onions = new JCheckBox("Onions"); static final JCheckBox pickled = new JCheckBox("pickled"); static final JCheckBox ketchup = new JCheckBox("ketchup"); static final JCheckBox cheese = new JCheckBox("cheese");
}
//Implemented Inheritance public class Burger12 implements GUI { //Implemeted Encapsulation private static int totalAmount = 0;
public static void calculateTotal(String S,int a) { totalAmount=0; if(a>0) { totalAmount+=a; } for(int i=0;i if(S.equals(s[i])) { totalAmount+=priceArray[i]; break; } } }
public static void calculateTotal(String S,String co,int a) { totalAmount=0; if(a>0) { totalAmount+=a; } for(int i=0;i if(S.equals(s[i])) { totalAmount+=totalAmount+=priceArray[i];
break;
} } }
public static void main(String[] args) { button.setBounds(50, 30, 150, 30); frame.add(button); frame.setSize(300, 300); frame.setLayout(null); frame.setVisible(true); Image logo = Toolkit.getDefaultToolkit().getImage("burger.jpg"); frame.setIconImage(logo); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { button.setBounds(0, 0, 0, 0); menu1.setBounds(100, 100, 200, 30); co.setBounds(100, 150, 200, 30); sizeLabel.setBounds(100, 260,100,30); regular.setBounds(400, 260, 100, 30); large.setBounds(500, 260, 100, 30); menu.setBounds(400, 100, 200, 30); co1.setBounds(400, 300, 200, 30); drinks.setBounds(100, 300, 200, 30); Tomatoes.setBounds(400, 150, 100,30); frame.add(Tomatoes); Onions.setBounds(400, 180, 100,30); frame.add(Onions); ketchup.setBounds(400, 210, 100,30); frame.add(ketchup); lettuce.setBounds(510, 150, 100,30); frame.add(lettuce); pickled.setBounds(510, 180, 100,30); frame.add(pickled); cheese.setBounds(510, 210, 100,30); frame.add(cheese); total.setBounds(100, 350, 300, 30); totalA.setBounds(100, 400, 500, 30); makeP.setBounds(0,0,0,0); frame.add(sizeLabel); frame.add(totalA); frame.add(total); frame.add(co1); frame.add(drinks); frame.add(menu1); frame.add(co); frame.add(regular); frame.add(eA); frame.add(large); frame.add(result); frame.add(menu); frame.add(last); frame.add(result); frame.add(makeP); frame.resize(700, 700); frame.revalidate(); frame.repaint(); //labmda exprmisson regular.addActionListener((ActionEvent e1) -> { large.setSelected(false); }); large.addActionListener((ActionEvent e1) -> { regular.setSelected(false); }); total.addActionListener((ActionEvent e1) -> { int totalCustomizationPrice = 0; int customizationPrice = 3; // for every customization $3 will be added if(Tomatoes.isSelected()) totalCustomizationPrice += customizationPrice; if(Onions.isSelected()) totalCustomizationPrice += customizationPrice; if(ketchup.isSelected()) totalCustomizationPrice += customizationPrice; if(lettuce.isSelected()) totalCustomizationPrice += customizationPrice; if(pickled.isSelected()) totalCustomizationPrice += customizationPrice; if(cheese.isSelected()) totalCustomizationPrice += customizationPrice; String S=menu.getItemAt(menu.getSelectedIndex()); String co1Text = co1.getItemAt(co1.getSelectedIndex()); if(co1Text.equals("")||co1Text == null||co1Text.equals("none")) { if(regular.isSelected()) { calculateTotal(S,totalCustomizationPrice + 5); }else { calculateTotal(S,totalCustomizationPrice + 8); } }else { int drinkPrice = 3; if(regular.isSelected()) { calculateTotal(S,co1Text,totalCustomizationPrice + drinkPrice + 5); }else { calculateTotal(S,co1Text,totalCustomizationPrice + drinkPrice + 8); } } totalA.setText("Total Amount: "+totalAmount); makeP.setBounds(100,500,300,30); eA.setBounds(100,450,200,30); result.setBounds(400,450,200,30); makeP.addActionListener((ActionEvent e2) -> { double z=Double.parseDouble(result.getText().toString()); if(z last.setBounds(100,550,400,30); last.setText("Invalid Amount, Enter again the total price of his order..!!"); }else { last.setBounds(100,550,400,50); last.setText("Payment successfully done and your order is under process Thanks for visiting us..!!"); } }); }); } }); } }

Everything We Do Is Gourmet Station Burger
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
