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

I need help with the entire code. Due by Saturday midnight Consider the follwing

ID: 3872485 • Letter: I

Question

I need help with the entire code.

Due by Saturday midnight

Consider the follwing GUI based java application for pizza price calculation. Joe's Pizza Pizza TypeToppings $15.00 Cheese | |DExtraCheese Pepperoni | | Bacon Veggi Mushroom Calculate Total Develop a java Ul for pizza bill calculation for Joe's pizza store. Each Toping is $1.50 and one can chose up to three toppings. Also, Cheese pizza is $10.00 while Pepperoni and Veggie are $12.00 and $15.00 respectively. How to run: Users can select a pizza type and toppings. Then, press "Calculate Total" button. Total bill will appear inside the text area in the right.

Explanation / Answer

import javax.swing.*;

import java.awt.event.*;

import java.awt.*;

class pizza extends JFrame implements ActionListener{

JRadioButton rb1,rb2,rb3;

Checkbox checkbox1,checkbox2,checkbox3;

JButton b; JTextField tf1; double cost=0;

Label label = new Label();

pizza(){

JFrame f= new JFrame();

//Label.setAlignment(Label.LEFT);

label.setSize(400,100);

label.setText("Joe's Pizza");

label.setBounds(0,5,100,30);

tf1=new JTextField();

tf1.setBounds(500,5,150,200);

rb1=new JRadioButton("Cheese");

rb1.setBounds(100,50,100,30);

rb2=new JRadioButton("Peperoni");

rb2.setBounds(100,100,100,30);

rb3=new JRadioButton("Veggie");

rb3.setBounds(100,150,100,30);

  

ButtonGroup bg=new ButtonGroup();

bg.add(rb1);bg.add(rb2); bg.add(rb3);

b=new JButton("Calculate total");

b.setBounds(0,250,600,30);

b.addActionListener(this);

checkbox1 = new Checkbox("Extra cheese");

checkbox1.setBounds(200,50, 100,30);

checkbox2 = new Checkbox("Bacon");

checkbox2.setBounds(200,100, 100,30);

checkbox3 = new Checkbox("Mushroom");

checkbox3.setBounds(200,150, 100,30);

add(checkbox1); add(checkbox2); add(checkbox3);add(label);

  

add(rb1);add(rb2); add(rb3);add(b); add(tf1);

checkbox1.addItemListener(new ItemListener() {

public void itemStateChanged(ItemEvent e) {   

cost=cost+1.5;

}

});

checkbox2.addItemListener(new ItemListener() {

public void itemStateChanged(ItemEvent e) {   

cost=cost+1.5;

}

});

checkbox3.addItemListener(new ItemListener() {

public void itemStateChanged(ItemEvent e) {   

cost=cost+1.5;

}

});   

setSize(600,350);

setLayout(null);

setVisible(true);

}

public void actionPerformed(ActionEvent e){

if(rb1.isSelected()){

cost=cost+10;

tf1.setText(cost+" "   

);

cost=0; }

if(rb2.isSelected()){

cost=cost+12;

tf1.setText(cost+" "   

);

tf1.setText(cost+" "   

);

cost=0; }

if(rb3.isSelected()){

cost=cost+15;

tf1.setText(cost+" "   

);

  

  

cost=0;

}

}

public static void main(String args[]){

new pizza();

}}