Complete this problem on Sheet5 You are an employee at a piz
Complete this problem on Sheet5. You are an employee at a pizza parlor and are asked to create a UserForm that calculates the cost of a pizza. The price is based on the pizza’s size, the number of toppings, and how the pizza will be obtained by the customer. • Allow the user to select the pizza size using OptionButtons. There will be four sizes so you will need to create four OptionButtons. If the user selects a small pizza, the cost will be $5.00. If the user selects a medium pizza, the cost will be $7.00. If the user selects a large pizza, the cost will be $9.00. If the user selects an extra large pizza, the cost will be $13.00. • Allow the user to select the pizza toppings using CheckBoxes. There will be three toppings so you will need three CheckBoxes. All CheckBoxes should initially be unchecked (their initial value is False). The cost of the pizza should increase when the user selects a CheckBox and decrease when the user unselects a CheckBox. If the user selects pepperoni, the cost will increase by $1.00. If the user selects sausage, the cost will increase by $1.50. If the user selects mushrooms, the cost will increase by $0.75. • Allow the user to select how the customer will obtain the pizza using a ComboBox. If the user will pick up the pizza at the restaurant, there is no additional cost. If the user wants the pizza delivered to his or her home, there will be an additional $3 fee. On Sheet5, create a run button that will open the UserForm. You also will create three CommandButtons on the UserForm • One CommandButtons will calculate the cost of the pizza and display this value in a TextBox. • The second CommandButton will close the UserForm. • The third CommandButton will reset the UserForm. The CheckBoxes will become unchecked, no OptionButton will be selected, no item will be selected in the ComboBox, and no value will appear in the TextBox. For example, if the customer wants a medium pizza with pepperoni and mushrooms delivered to his home, the value displayed in the TextBox would be $11.75.
Solution
 import java.awt.*;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
import javax.swing.*;
 public class PizzaPriceFrame extends JFrame {
private static final long serialVersionUID = 1L;
 private JRadioButton SButton, MButton, LButton,XLButton;
 private JCheckBox PCheckBox, MCheckBox,SCheckBox;
 private JTextField priceTextField;
 private double price = 0.0;
 private double topPrice = 0.0;
 private double showPrice = 0.0;
 private ActionListener listener = new PriceListener();
public PizzaPriceFrame() {
   
private void MakeRadioButtonSize(){
   
 SButton = new JRadioButton(\" Small \");
 SButton.addActionListener(listener);
 radioButtonPanel.add(SButton);
MButton = new JRadioButton(\" Medium \");
 MButton.addActionListener(listener);
 radioButtonPanel.add(MButton);
LButton = new JRadioButton(\" Large \");
 LButton.addActionListener(listener);
 radioButtonPanel.add(LButton);
XLButton = new JRadioButton(\" XtraLarge \");
 XLButton.addActionListener(listener);
 radioButtonPanel.add(XLButton);
}
private void MakeCheckBoxTopping() {
   
PCheckBox = new JCheckBox(\" Pepperoni \");
 PCheckBox.addActionListener(listener);
   
MCheckBox = new JCheckBox(\" Mushrooms \");
 MCheckBox.addActionListener(listener);
   
SCheckBox = new JCheckBox(\" Sausage \");
 SCheckBox.addActionListener(listener);
   
}
private void MakeComboBoxdining()
 {
 String[] Dining={“restaurant”,”home delivery”};
 JComboBox Dining=new JComboBox(Dining);
 Dining.setselectedIndex(2);
 Dining.addActionListener(this);
 }
private void createPricePanel() {
   
 pricePanel.add(priceTextField);
 priceTextField.setText(\" n/a Price\");
 }
  
 private class PriceListener implements ActionListener {
public void actionPerformed(ActionEvent event) {
 OPrice = 0;
 if (SButton.isSelected()) {
 price = 5.00;
 } else if (MButton.isSelected()) {
 price = 7.00;
 } else if (LButton.isSelected()) {
 price = 9.00;
} else if (XLButton.isSelected()) {
 price = 13.00;
 }
 if (PCheckBox.isSelected()) {
 OPrice = 1.00;
 } else if (MCheckBox.isSelected()) {
 OPrice = 1.50;
 }else if (SCheckBox.isSelected()) {
 OPrice = 0.75;
}
JComboBox d= (JComboBox)e.getSource();
 String Dining = (String)d.getSelectedItem();
if(d.SelectedItem ==” restaurant” )
 {
 OPrice=0.00;
}else if(d.SelectedItem ==” home delivery”)
 {OPrice=3.00;
 }
 }
 EventQueue.invokeLater(new Runnable() {
@Override
 public void run() {
 showPrice = price + OPrice;
 priceTextField.setText(\" $\" + showPrice);
 System.out.println(\"Total Price\");
 }
 });
}
 }
public static void main(String[] args) {
 EventQueue.invokeLater(new Runnable() {
@Override
 public void run() {
 PizzaPriceFrame P = new PizzaPriceFrame();
 System.out.println(\"Run\");
 }



