I am trying to finsih this coding and something is missing and teacher has asked me to init the doubles. I am struggling with the finishing touches of this program.

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
/**
 *  The MenuWindow class demonstrates a menu system.
 */
public class CellPhonePackage extends JFrame
{
   private JLabel messageLabel;            // Displays message
   private JLabel results;// Displays message
   private final int LABEL_WIDTH = 400;    
   private final int LABEL_HEIGHT = 200;   

   // The following variables will reference menu components.
   private JMenuBar menuBar;   
   private JMenu fileMenu;     
   private JMenu textMenu;     
   private JMenu cellMenu;     
   private JMenu addMenu;     
   private JMenuItem exitItem;                  //Exits the application
   private JRadioButtonMenuItem blackItem;      // Makes text black
   private JRadioButtonMenuItem redItem;        // Makes text red
   private JRadioButtonMenuItem blueItem;       // Makes text blue
   private JRadioButtonMenuItem blackItem1;     // Makes text black
   private JRadioButtonMenuItem redItem1;       // Makes text red
   private JRadioButtonMenuItem blueItem1;      // Makes text blue
   private JCheckBoxMenuItem voiceItem;         //Toggles visibility
   private JCheckBoxMenuItem textItem;          // Toggles visibility
   /**
    *  Constructor
    */
   public CellPhonePackage()
   {
      // Call the JFrame constructor.
      super("Cell Phone Package");
      // Specify an action for the close button.
      setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      // Create the message label and set its size and color.
      messageLabel = new JLabel("Use the  menu to " +
                 "select the best plan for you.",
                 SwingConstants.CENTER);
      messageLabel.setPreferredSize(
                 new Dimension(LABEL_WIDTH, LABEL_HEIGHT));
      messageLabel.setForeground(Color.BLACK);

      // Add the label to the content pane.
      add(messageLabel);

      // Build the menu bar.
      buildMenuBar();

      // Pack and display the window.
      pack();
      setVisible(true);
   }
   /**
    *  BuildMenuBar method builds menu bar.
    */
   private void buildMenuBar()
   {
      menuBar = new JMenuBar();
      buildFileMenu();
      buildTextMenu();
      buildAddMenu();
      buildCellMenu();
      // Add the file and text menus to the menu bar.
      menuBar.add(fileMenu);
      menuBar.add(textMenu);
      menuBar.add(addMenu);
      menuBar.add(cellMenu);
      // Set window menu bar.
      setJMenuBar(menuBar);
   }
   /**
    * BuildFileMenu method builds the File menu and returns
    * reference to its JMenu object.
    */
   private void buildFileMenu()
   {
      exitItem = new JMenuItem("Exit");
      exitItem.setMnemonic(KeyEvent.VK_X);
      exitItem.addActionListener(new ExitListener());
      fileMenu = new JMenu("File");
      fileMenu.setMnemonic(KeyEvent.VK_F);
      fileMenu.add(exitItem);
   }
   /**
    * buildTextMenu method builds the Text menu and returns
    * a reference to its JMenu object.
    */
   private void buildTextMenu()
   {
      // Create the radio button menu items to change the color
      // of the text. Add an action listener to each one.
      blackItem = new JRadioButtonMenuItem("300 minutes:$45 per month", true);
      blackItem.setMnemonic(KeyEvent.VK_B);
      blackItem.addActionListener(new PlanListener());
      redItem = new JRadioButtonMenuItem("800 minutes:$65 per month");
      redItem.setMnemonic(KeyEvent.VK_R);
      redItem.addActionListener(new PlanListener());
      blueItem = new JRadioButtonMenuItem("1500 minutes:$99 per month");
      blueItem.setMnemonic(KeyEvent.VK_U);
      blueItem.addActionListener(new PlanListener());
      // Create a button group for the radio button items.
      ButtonGroup group = new ButtonGroup();
      group.add(blackItem);
      group.add(redItem);
      group.add(blueItem);
      // Create a JMenu object for the Text menu.
      textMenu = new JMenu("Minutes");
      textMenu.setMnemonic(KeyEvent.VK_T);
      // Add the menu items to the Text menu.
      textMenu.add(blackItem);
      textMenu.add(redItem);
      textMenu.add(blueItem);
   }
    private void buildAddMenu()
      {
         // Create the radio button menu items to change the color
         // of the text. Add an action listener to each one.
         blackItem1 = new JRadioButtonMenuItem("Model 100:$29.95", true);
         blackItem1.setMnemonic(KeyEvent.VK_S);
         blackItem1.addActionListener(new PlanListener());
         redItem1 = new JRadioButtonMenuItem("Model 110:$49.95");
         redItem1.setMnemonic(KeyEvent.VK_K);
         redItem1.addActionListener(new PlanListener());
         blueItem1 = new JRadioButtonMenuItem("Model 200:$99.95");
         blueItem1.setMnemonic(KeyEvent.VK_P);
         blueItem1.addActionListener(new PlanListener());
         // Create a button group for the radio button items.
         ButtonGroup group = new ButtonGroup();
         group.add(blackItem1);
         group.add(redItem1);
         group.add(blueItem1);
         // Create a JMenu object for the Text menu.
         addMenu = new JMenu("Cell-Phone model");
         textMenu.setMnemonic(KeyEvent.VK_Z);
         // Add the menu items to the Text menu.
         addMenu.add(blackItem1);
         addMenu.add(redItem1);
         addMenu.add(blueItem1);
   }
    private void buildCellMenu()
    {
      // Create a check box menu item to make the text
      // visible or invisible.
      voiceItem = new JCheckBoxMenuItem("Voice mail option", true);
      voiceItem.setMnemonic(KeyEvent.VK_E);
      voiceItem.addActionListener(new PlanListener());
      // Create a check box menu item to make the text
      // visible or invisible.
      textItem = new JCheckBoxMenuItem("Text message option", true);
      textItem.setMnemonic(KeyEvent.VK_F);
      textItem.addActionListener(new PlanListener());
      // Create a JMenu object for the Text menu.
      cellMenu = new JMenu("Add ons");
      cellMenu.setMnemonic(KeyEvent.VK_D);
      // Add the menu items to the Text menu.
      cellMenu.add(voiceItem);
      cellMenu.add(textItem);
    }
   /**
    * Private inner class that handles the event that
    * is generated when the user selects Exit from
    * the File menu.
    */
    private class ExitListener implements ActionListener
    {
      public void actionPerformed(ActionEvent e)
      {
         System.exit(0);
      }
    }
   /**
    * Private inner class that handles the event that
    * is generated when the user selects a color from
    * the Text menu.
    */
    private class PlanListener implements ActionListener
    {
      public void actionPerformed(ActionEvent e)
      {
          double plan1 = 0;
          double package1 = 0;
          double text = 0;
          double message = 0;
          double addOn = 0;
          double total = 0;
         // Determine which color was selected and
         // act accordingly.
          if (blackItem.isSelected())
               plan1=45;
          else if (redItem.isSelected())
               plan1=65;
          else if (blueItem.isSelected())
               plan1=99; //} Thanks for those!

          if (blackItem1.isSelected())//;
               package1=29.95;
          else if (redItem1.isSelected())
               package1=49.95;
          else if (blueItem1.isSelected())
               package1=99.95;//}


          if (voiceItem.isSelected())
              message =5;
          if(textItem.isSelected())
               text=10;
    addOn=message + text;
        total= package1+(6/package1)*100+ plan1+ addOn;
      }
    }
   /**
    * Creates an instance of the MenuWindow class,
    * which causes it to display a window.
    */
   public static void main(String[] args)
   {
      //new MenuWindow();
       new CellPhonePackage();
   }
}

Where is the output? Were you required to make all of those items menu items? It doesn't seem very user-friendly.

you understand that mentioning what the parts are you are struggling with would make it easier for us to help you, right?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.