Menu

[Solved]Java Programming Please Help Figure Build Part Following Assignment Please Check Portion C Q37153621

Java Programming. Please help me figure out how to build thispart of the following assignment. Please check this portion of mycode and show me how do I test this portion of my code.

Thank you.

乡 Order Calculator Topping Drinks Base Cheese coke Tuna Peppern Sweet Tea O Thin Crust ⓔ Diet Coke O Raised Crust El Mushroom

Code:
public class BasePanel{

   /**
   *
   */
   //private static final long serialVersionUID =1L;
   /**
   * represents the thin and raised crust buttons
   */
   private JRadioButton thin;
   private JRadioButton raised;

   /**
   * represents the base panel
   */
   private JPanel panel1;

   /**
   * represents the price of the type of crust
   */
   private double basePrice;

   /**
   *Action listener object that sets the base price
   */
   private ActionListener listener;

   /**
   * constructor creates a panel for the basechoices,
   * creates adds to the created panel
   */
   public BasePanel(){

       /**
       * Panel 1: Base Panel
       */
       JPanel panel1 = new JPanel(newBorderLayout());
       panel1.setLayout(newGridLayout(3,1));
      panel1.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),”Base”));

       listener = new BaseButton();

       /**
       * Create JRadioButtons for thin andraised crust
       */
       JRadioButton thin = newJRadioButton(“Thin Crust”, true);
       JRadioButton raised = newJRadioButton(“Raised Crust”);

       /**
       * Adding ButtonGroups of abovebuttons
       */

       ButtonGroup bgroup = newButtonGroup();
       bgroup.add(thin);
       bgroup.add(raised);

       // ActionListener listener =null;
       /**
       * addActionListeners tobuttons
       */
      thin.addActionListener(listener);
      raised.addActionListener(listener);

       /**
       * Place ButtonGroups vertically inthe center
       */
      thin.setVerticalAlignment(SwingConstants.CENTER);
      raised.setVerticalAlignment(SwingConstants.CENTER);

       /**
       * Vertical Alignment ofJPanel
       */
       //JPanel panel1 = newJPanel();
       panel1.add(thin);
       panel1.add(raised);
       return;
   }

   /**
   * This method sets the price of the base
   */
   public double getBasePrice() {
       return basePrice;
   }

   public JPanel getPanel1() {
       return panel1;
   }

   public void setPanel1(JPanel panel1) {
       this.panel1 = panel1;
   }

   /**
   * class that deals with the selection of the baseprice
   */
   private class BaseButton implementsActionListener{
       /**
       * This method sets the base priceaccording to the selection of the user
       */
       public voidactionPerformed(ActionEvent e) {

           basePrice =0;
          if(thin.isSelected()) {
              basePrice = 5.00;
           }
           elseif(raised.isSelected()){
              basePrice = 5.50;
           }

       }

   }
}

乡 Order Calculator Topping Drinks Base Cheese coke Tuna Peppern Sweet Tea O Thin Crust ⓔ Diet Coke O Raised Crust El Mushrooms Calculate Exit Show transcribed image text 乡 Order Calculator Topping Drinks Base Cheese coke Tuna Peppern Sweet Tea O Thin Crust ⓔ Diet Coke O Raised Crust El Mushrooms Calculate Exit

Expert Answer


Answer to Java Programming. Please help me figure out how to build this part of the following assignment. Please check this portio… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *