Create a user friendly interface to order a pizza. Use appropriate controls (radio buttons, list boxes, check boxes) to obtain the type of pizza (e.g. small, medium, large) and the toppings. Calculate the cost of the pizza based upon the size, number of toppings and delivery charge. Display a summary of the order in a text area along with the total cost. Provide buttons which places the order and clears the order.
Allow for multiple pizzas to orders
Submit as .jar file.
"Please use Eclipse to write this program"
PROGRAM CODE:
package pizza;
import java.awt.FlowLayout;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextArea;
public class PizzaOrderingApp {
static String pizzas[] = {"Select a Pizza", "Chicken
Supreme", "Chicken Exotica", "BBQ", "Italiana"};
static double basePizzaRate[] = {0, 10, 20, 15,
12};
static String toppings[] = {"Select a topping",
"Pineapple", "Jalapeno", "Onion", "Olives", "Capsicum"};
static double toppingsRate[] = {0, 1.5, 2, 1.9, 2.5,
2};
static String sizes[] = {"Small", "Medium",
"Large"};
static double sizesRate[] = {4, 5, 6};
static double totalAmount = 0;
public static void main(String args[])
{
JFrame frame = new JFrame();
JPanel pizzaSelectionPanel = new
JPanel(new GridBagLayout());
GridBagConstraints constraints =
new GridBagConstraints();
constraints.gridx = 0;
constraints.gridy = 0;
JComboBox<String>
pizzaSelections = new JComboBox<>(pizzas);
pizzaSelectionPanel.add(pizzaSelections, constraints);
JButton add = new
JButton("Add");
constraints.gridx = 1;
pizzaSelectionPanel.add(add,
constraints);
constraints.fill =
GridBagConstraints.VERTICAL;
constraints.gridx = 0;
constraints.gridy = 1;
pizzaSelectionPanel.add(new
JLabel("Your Selection: "), constraints);
JPanel selectedPanel = new
JPanel(new GridLayout(4, 2));
selectedPanel.setVisible(true);
JPanel buttonPanel = new JPanel(new
FlowLayout());
JButton order = new
JButton("Order");
JButton clear = new
JButton("Clear");
JTextArea area = new
JTextArea();
buttonPanel.add(order);
buttonPanel.add(clear);
order.addActionListener(new
ActionListener() {
@Override
public void
actionPerformed(ActionEvent e) {
area.setText("Total Amount: " +
totalAmount);
}
});
clear.addActionListener(new
ActionListener() {
@Override
public void
actionPerformed(ActionEvent e) {
totalAmount = 0;
selectedPanel.removeAll();
selectedPanel.repaint();
}
});
add.addActionListener(new
ActionListener() {
@Override
public void
actionPerformed(ActionEvent e) {
selectedPanel.add(new
JLabel(pizzaSelections.getSelectedItem().toString()));
totalAmount +=
basePizzaRate[pizzaSelections.getSelectedIndex()];
JButton customize = new
JButton("Customize");
customize.addActionListener(new ActionListener()
{
@Override
public void
actionPerformed(ActionEvent e) {
JFrame
customizerFrame = new JFrame("Customize " +
pizzaSelections.getSelectedItem().toString());
JComboBox<String> toppingsBox = new
JComboBox<String>(toppings);
JComboBox<String> sizesBox = new
JComboBox<>(sizes);
JButton
done = new JButton("Done");
customizerFrame.getContentPane().setLayout(new GridLayout(3, 2, 10,
10));
customizerFrame.getContentPane().add(new JLabel("Select your
topping: "));
customizerFrame.getContentPane().add(toppingsBox);
customizerFrame.getContentPane().add(new JLabel("Select the type:
"));
customizerFrame.getContentPane().add(sizesBox);
customizerFrame.getContentPane().add(done);
done.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e)
{
totalAmount +=
toppingsRate[toppingsBox.getSelectedIndex()];
totalAmount +=
sizesRate[sizesBox.getSelectedIndex()];
}
});
customizerFrame.setSize(300, 300);
customizerFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
customizerFrame.setVisible(true);
}
});
selectedPanel.add(customize);
selectedPanel.repaint();
frame.getContentPane().repaint();
}
});
frame.getContentPane().setLayout(new GridLayout(4, 1));
frame.getContentPane().add(pizzaSelectionPanel);
frame.getContentPane().add(selectedPanel);
frame.getContentPane().add(buttonPanel);
frame.getContentPane().add(area);
frame.setSize(500, 500);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
Create a user friendly interface to order a pizza. Use appropriate controls (radio buttons, list boxes,...
Java: Write an Applet Application to create a menu for a pizza shop. Use check boxes, radio buttons, and a JButton to allow a customer to make selections and process their order. Use a text area to display the customer's order and the amount due.
Hello, please help me to answer my assignment, i highly appreciate your effort, kindly explain it clearly. Kindly put your codes in (NOTEPAD). Thank you very much. Write a VB application that will facilitate a pizza order. 1.The user interface should have a form containing all components pertaining to pizza order presented in either option buttons or check boxes. 2.Controls must also be grouped in frames according to size, toppings, or crust type. 3.The summary of order must be presented...
JAVA Developing a graphical user interface in programming is paramount to being successful in the business industry. This project incorporates GUI techniques with other tools that you have learned about in this class. Here is your assignment: You work for a flooring company. They have asked you to be a part of their team because they need a computer programmer, analyst, and designer to aid them in tracking customer orders. Your skills will be needed in creating a GUI program...
I. User Interface Create a JavaFX application with a graphical user interface (GUI) based on the attached “GUI Mock-Up”. Write code to display each of the following screens in the GUI: A. A main screen, showing the following controls: • buttons for “Add”, “Modify”, “Delete”, “Search” for parts and products, and “Exit” • lists for parts and products • text boxes for searching for parts and products • title labels for parts, products, and the application title B. An add...
Domino’s Global Marketing Domino’s made its name by pioneering home delivery service of pizza in the United States. The company was founded in 1960 in Ypsilanti, Michigan, by Tom Monaghan and his brother, Jim. Domino’s Pizza was sold to Bain Capital in 1998 and went public in 2004. Before that, on May 12, 1983, Domino’s opened its first store internationally—in Winnipeg, Canada. And, in 2012, Domino’s Pizza removed the word “Pizza” from the logo to emphasize its non-pizza products. Its...
C+ HelloVisualWorld, pages 121-125 (in the 3-6 Deciding Which Interface to Use Section) We were unable to transcribe this imageCHAPTER 3 Using Guy Objects and the Visual Studio IDE Using Gul Objects (continued) Forn click the Form, its Properties window appears in the lower right portion of the screen, and you can see that the Text property for the Form IS set to Forml. Take a moment to scroll through the list in the Properties Window, examining the values of...
If you’re using Visual Studio Community 2015, as requested, the instructions below should be exact but minor discrepancies may require you to adjust. If you are attempting this assignment using another version of Visual Studio, you can expect differences in the look, feel, and/or step-by-step instructions below and you’ll have to determine the equivalent actions or operations for your version on your own. INTRODUCTION: In this assignment, you will develop some of the logic for, and then work with, the...