Question
I need to do some change in my java GUI program so please help me, I want to add list for (customize order). the list
I need to do some change in my java GUI program so please help me, I want to add list for (customize order). the list is (No Onions, No cheese, With Mainonese, no ketchup, no lettuce, With tomatoes, With pickle,) same menu list in top.
I want to add list of prices for my burger restaurant. (you can use price array of integer)
Classic Burger=11$
, fish Burger=9$
, Fries = 5$
, Chicken Burger= 8$
and for Big Size = 8$ extra,
Small is 5$ extra.
Or you can put random price as you like.
(So the user can see the details for his order with the price before clicking in the button Make Payment. The customer should insert the total amount of the order in the input box then click on Make Payment. The program should check if the amount of the total price is equal to the input number the customer entered, then the program can show a message payment successfully done and your order is under process, otherwise the program should ask the user to enter again the total price of his order) <<- very important
Note: please dont put the code as code. Just do it as Output (Screenshot) without copy and paste the code:
this is the code
//Burger.java
import java.awt.event.ActionEvent; import java.awt.event.ActionListener;
import javax.swing.*;
interface GUI { static final JFrame frame = new JFrame("Order"); static final JButton button = new JButton("Make an Order"); static final JLabel menu1 = new JLabel("Menu"); static final JLabel co = new JLabel("Customize Order: "); static final JTextArea co1 = new JTextArea(); 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" }; static final JComboBox
//Implemented Inheritance public class Burger implements GUI { //Implemeted Encapsulation private static int totalAmount = 0;
public static void calculateTotal(String S,int a) { totalAmount=0; if(a==1) { totalAmount+=50; } for(int i=0;i public static void calculateTotal(String S,String co,int a) { totalAmount=0; if(a==1) { totalAmount+=50; } for(int i=0;i 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); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { button.setBounds(0, 0, 0, 0); menu1.setBounds(100, 100, 200, 30); co.setBounds(100, 150, 200, 30); regular.setBounds(100, 200, 200, 30); large.setBounds(400, 200, 200, 30); menu.setBounds(400, 100, 200, 30); co1.setBounds(400, 150, 200, 30); total.setBounds(100, 250, 300, 30); totalA.setBounds(100, 300, 500, 30); makeP.setBounds(0,0,0,0); frame.add(totalA); frame.add(total); frame.add(co1); 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(); regular.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { large.setSelected(false); } }); large.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { regular.setSelected(false); } }); total.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String S=menu.getItemAt(menu.getSelectedIndex()); if(co1.getText().toString().equals("")||co1.getText().toString().equals(null)) { if(regular.isSelected()) { calculateTotal(S,0); }else { calculateTotal(S,0); } }else { calculateTotal(S,co1.getText().toString(),0); } totalA.setText("Total Amount: "+totalAmount); makeP.setBounds(100,400,300,30); eA.setBounds(100,350,200,30); result.setBounds(400,350,200,30); makeP.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { double z=Double.parseDouble(result.getText().toString()); if(z
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started