Question

In: Computer Science

******You do not need to get everything working exactly as it says, I mostly just need...

******You do not need to get everything working exactly as it says, I mostly just need an outline of how to create this GUI and add up the costs and print them all out. Any help at all will be greatly appreciated*******

Design and implement a Java program that creates a GUI that will allow a customer to order pizza and other items from a Pizza Paarlor.  The customer should be able to order a variety of items which are listed below. The GUI should allow the customer (via JavaFX UI Controls - text areas, buttons, checkbox, radio button, etc.) to input the following information:

  • Customer Contact Info (Use text fields to input these from user)
    • First Name
    • Last Name
    • Phone Number
    • Address
  • Type of food that can be ordered are: (Use dropdown menu to pick)
    • pizza
      • Small
      • Large
    • calzone
    • garlic knots
  • Quantity of each food item being ordered (Use text field that only accepts numbers to type in a number between 1 and 50 )
    • Pizza toppings (Use dropdown to pick)
      • Plain
      • Extra cheese
      • Mushrooms
      • Pepperoni

    Pricing (assign these prices to each item)

    Base Price for items :

  • Small Plain Pie –  $11.25
  • Large Plain Pie –  $14.00
  • Calzone - $7.75
  • Garlic Knots -$3.50
  • Additional fees for Toppings:

  • Small Pie - $2.00 per topping
  • Large Pie - $3.00 per topping

Conditions:

  • The GUI will have two buttons. The first will be used to create a running total of the current order. This button should be clicked every time an item is added to the order to give a current total of the order.
  • The second button will be used to print the following:
    • Customer Contact Info
    • All items and the quantity ordered
    • The grand total for the order

Solutions

Expert Solution

// UI CODE
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;

public class MyPanel extends JPanel {
    private JLabel Pizza Parlor;
    private JLabel FirstName;
    private JTextField jcomp3;
    private JLabel LastName;
    private JTextField jcomp5;
    private JLabel Phone;
    private JTextField jcomp7;
    private JLabel jcomp8;
    private JTextField jcomp9;
    private JLabel jcomp10;
    private JLabel jcomp11;
    private JTextField jcomp12;
    private JComboBox Types;
    private JLabel Pizza Toppings;
    private JComboBox jcomp15;
    private JButton Total Sum;
    private JButton jcomp17;

    public MyPanel() {
        //construct preComponents
        String[] TypesItems = {"Small", "Large", "calzone", "garlic knots"};
        String[] jcomp15Items = {"Plain", "Extra cheese", "Mushrooms", "Pepperoni"};

        //construct components
        Pizza Parlor = new JLabel ("Pizza Parlor");
        FirstName = new JLabel ("First Name");
        jcomp3 = new JTextField (5);
        LastName = new JLabel ("Last Name");
        jcomp5 = new JTextField (5);
        Phone = new JLabel ("Phone No.");
        jcomp7 = new JTextField (5);
        jcomp8 = new JLabel ("Address");
        jcomp9 = new JTextField (5);
        jcomp10 = new JLabel ("Type of Pizza");
        jcomp11 = new JLabel ("Quantity");
        jcomp12 = new JTextField (5);
        Types = new JComboBox (TypesItems);
        Pizza Toppings = new JLabel ("Pizza Toppings");
        jcomp15 = new JComboBox (jcomp15Items);
        Total Sum = new JButton ("Total Sum");
        jcomp17 = new JButton ("Submit Info");

        //set components properties
        Pizza Parlor.setToolTipText ("Pizza Parlor");
        Types.setToolTipText ("Types of Pizza");

        //adjust size and set layout
        setPreferredSize (new Dimension (667, 393));
        setLayout (null);

        //add components
        add (Pizza Parlor);
        add (FirstName);
        add (jcomp3);
        add (LastName);
        add (jcomp5);
        add (Phone);
        add (jcomp7);
        add (jcomp8);
        add (jcomp9);
        add (jcomp10);
        add (jcomp11);
        add (jcomp12);
        add (Types);
        add (Pizza Toppings);
        add (jcomp15);
        add (Total Sum);
        add (jcomp17);

        //set component bounds (only needed by Absolute Positioning)
        Pizza Parlor.setBounds (265, 10, 70, 25);
        FirstName.setBounds (5, 70, 100, 25);
        jcomp3.setBounds (80, 75, 100, 20);
        LastName.setBounds (5, 120, 100, 25);
        jcomp5.setBounds (80, 120, 100, 20);
        Phone.setBounds (5, 160, 100, 25);
        jcomp7.setBounds (80, 160, 100, 20);
        jcomp8.setBounds (5, 200, 70, 25);
        jcomp9.setBounds (80, 205, 105, 60);
        jcomp10.setBounds (290, 70, 100, 25);
        jcomp11.setBounds (295, 110, 100, 25);
        jcomp12.setBounds (410, 115, 100, 25);
        Types.setBounds (410, 75, 100, 25);
        Pizza Toppings.setBounds (295, 155, 100, 25);
        jcomp15.setBounds (410, 155, 100, 25);
        Total Sum.setBounds (360, 220, 100, 25);
        jcomp17.setBounds (45, 315, 100, 25);
    }


    public static void main (String[] args) {
        JFrame frame = new JFrame ("MyPanel");
        frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
        frame.getContentPane().add (new MyPanel());
        frame.pack();
        frame.setVisible (true);
    }
}

Related Solutions

I have the answers for everything, I just need for it to be explained as to...
I have the answers for everything, I just need for it to be explained as to why that's the answer. A 24-year old female automotive technician presents herself at the doctor’s office. She complains of fever and of pain in her left hand. On physical examination, the patient had a deep wound on her left palm that was oozing pus. She had purplish, red streaks running up her left arm. She had enlarged lymph nodes at the elbow and under...
What exactly does Sartre mean when he says that"if Goddoes not exist, then everything is...
What exactly does Sartre mean when he says that"if God does not exist, then everything is permitted"? Do you agree with him? Why or why not?
What exactly does Sartre mean when he says that "If God does not exist, then everything...
What exactly does Sartre mean when he says that "If God does not exist, then everything is permitted"? Do you agree with him? Why or why not?
please do not change the category. you just typing no drawing needed i need Just speed...
please do not change the category. you just typing no drawing needed i need Just speed and few sentences! its easy for you. problem 1) Describe the pros and cons between BJT the Voltage divider Bias, Emitter Bias, Collector Feedback Bias. 2) Compare the Voutput and current characteristics between BJT Early Effect, Fet Channel. And cause of that two.
Why do you think a third financial statement is important? Do we not get everything we...
Why do you think a third financial statement is important? Do we not get everything we need from the Balance Sheet and Income Statement? What information does the Cash Flow Statement give us that is unique, and why do investors need that information?
For my economy class I need to annswer these questions but I just dont get/cant find...
For my economy class I need to annswer these questions but I just dont get/cant find the right inf. The Presentville – Futureville case: 1. Explain what motivated each group to make the decisions they made.
I need to do a research paper on self-esteem and job performance. I just need some...
I need to do a research paper on self-esteem and job performance. I just need some ideas to get me started
I mostly need questions 4-9, thank you! NOTE: For question 1, you will be using the...
I mostly need questions 4-9, thank you! NOTE: For question 1, you will be using the data file your instructor has provided you. Coin 7 6 4 6 4 6 4 6 4 4 3 5 5 6 3 3 5 6 3 7 5 2 6 6 6 3 3 7 2 4 6 5 6 6 7 (12 pts) Using the data file from your instructor, calculate descriptive statistics for the variable (Coin) where each of the thirty-five...
(i just need an answer for question 4) (i just need an answer for just question...
(i just need an answer for question 4) (i just need an answer for just question 4) you have two facilities, one in Malaysia and one in Indonesia. The variable cost curve in the Malaysian plant is described as follows: VCM = q­ + .0005*q2 , where q is quantity produced in that plant per month. The variable cost curve in the Indonesian plant is described by VCI = .5q + .00075q2, where q is the quantity produced in that...
Answers are in bold under questions. I just need to know how to get them, so...
Answers are in bold under questions. I just need to know how to get them, so Please show work!! A) If 25% of all vehicles at a certain emissions inspection failed the inspection. Assuming that successive vehicles pass or fail independently of one another. Calculate the following probabilities: At least seven of the last 40 vehicles inspected failed. 0.9038 B) If 25% of all vehicles at a certain emissions inspection failed the inspection. Assuming that successive vehicles pass or fail...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT