Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a Java program to create Graphical User Interface for the Pizza shop proje

ID: 3827851 • Letter: W

Question

Write a Java program to create Graphical User Interface for the Pizza shop project.

Create User Interface where

1. the user can select Small, Medium or Large pizza from the the UI (User Interface)

2. the user can enter number of toppings on the User Interface

3. the user can click the button 'Order More' or 'Print bill to file and Exit' .

If the user clicks the button ‘Order More’, the customer gets 50% off for the consecutive pizza orders as the shop has an offer.

If the customer buys 3 pizzas,

total price = price of the first pizza +50% of the price of the second pizza+ 50% of the price of the third pizza +.....

If the user clicks on 'Print bill to file and Exit' , your program should print the pizza bill to a file and exit the system.

Explanation / Answer

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JButton;

import javax.swing.JPanel;

import javax.swing.JComboBox;

public class Pizaa {

public static void main(String[] args) {

    JFrame frame = new JFrame("CHEGG PIZZA");

    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

   frame.setLocation(150, 250);

    frame.setSize(200, 200);

    frame.setVisible(true);

    JPanel panel = new JPanel();

    frame.add(panel);

    JLabel lbl = new JLabel("SELECT SIZE OF PIZZA");

    lbl.setVisible(true);

    panel.add(lbl);

    String[] choices = { "SMALL","MEDIUM", "LARGE"};

    final JComboBox<String> jb = new JComboBox<String>(choices);

    jb.setVisible(true);

    panel.add(cb);

    JButton btn = new JButton("ok");

    panel.add(btn);

// the user can enter number of toppings on the User Interface here

TextField textField = new JTextField(20);

//it will add textfield to container

frame.add(textField);

dialog.add(textField);

panel.add(textField);

applet.getContentPane().add(textField);

//adding button here

JButton b=new JButton("Order More");  

  b.setBounds(25,75,125,40);  

f.add(b);  

  f.setSize(300,200);  

f.setVisible(true);

JButton b=new JButton("Print bill to file and Exit'");  

  b.setBounds(25,75,125,40);  

f.add(b);  

f.setSize(300,200);

f.setVisible(true);  

    }

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote