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

I have been working on a Java program for sometime now. I have had codes sent to

ID: 3634586 • Letter: I

Question

I have been working on a Java program for sometime now. I have had codes sent to me that I never could get to compile. I now have a working program like what I need. All I need help with is putting in the GUI Calculator. I will post the desription of the program along with the code I have. If someone can help with the calculator part.

Problem Description:

The skate shop sells the skateboard products listed on the table below:

Decks

Truck Assemblies

Wheels

The Master Thrasher $ 60

7.75- inch axle $ 35

51 mm $ 20

The Dictator $ 45

8- inch axle $ 40

55 mm $ 22

The Street King $ 50

8.5- inch axle $ 45

58 mm $ 24

61 mm $ 28

In addition, the Skate Shop sells the following miscellaneous products and services:

Create an application that allows the user to select one deck, one truck assembly, and one wheel set from either list components or combo boxes. The application should also have a list component that allows the user to select multiple miscellaneous products. The application should display the subtotal, the amount of sales tax ( at 6%), and the total of the order.

Analysis:

(Describe the purpose, processing, input and output in your own words.)

Design:

(Draw the user interface diagram.)

Testing: (Describe how you test this program)

My code is as follows

import javax.swing.*;
import java.awt.event.*;
import java.awt.*;

/**
* Write a description of class SkateboardDesigner here.
*
* @author  
* @version 11/30/2011
*/

public class Skateboard extends JFrame
{
   private JLabel bannerLabel;
   private JPanel northPanel;
  
   private JList deckList, truckList, wheelsList, miscList;
   private JPanel deckPanel, truckPanel, wheelsPanel, miscPanel, centerPanel;
  
   private JButton calcButton, exitButton;
   private JPanel southPanel;
  
  
  
   String[] decks = {"The Master Thrasher $ 60" , "The Dictator $ 45" , "The Street King $ 50"};
   String[] trucks = {"7.75- inch axle $35" , "8 - inch axle $ 40", "8.5 - inch axle $45" };
   String[] wheels = {"51 mm $22" , "55 mm $22" , "61 mm $28"};
   String[] miscs = {"Grip tape: $10", "Bearings: $30" , "Riser pads: $2" , "Nuts and Bolts kit: $3"};  
  
  
   /**
    * Constructor for objects of class Skateboard
    */
   public Skateboard()
   {
       super("Skateboard Designer");
       setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
       buildNorthPanel();
       buildCentralPanel();
       buildSouthPanel();
       getContentPane().add(northPanel, BorderLayout.NORTH);
       getContentPane().add(centerPanel, BorderLayout.CENTER);
       getContentPane().add(southPanel, BorderLayout.SOUTH);
       pack();
       setVisible(true);
      
    }
    public void buildNorthPanel()
    {
        bannerLabel = new JLabel("Skateboard Assembly");
        bannerLabel.setFont(new Font("Serif" , Font.BOLD, 24));
       
        northPanel = new JPanel();
        northPanel.setLayout(new FlowLayout(FlowLayout.CENTER));
       
        northPanel.add(bannerLabel);
       
       
    }
    public void buildCentralPanel()
    {
      deckList = new JList (decks);
      truckList = new JList (trucks);
      wheelsList = new JList (wheels);
      miscList = new JList (miscs);
     
     
      miscList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
      deckList.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
      wheelsList.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
      truckList.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
     
     
      deckPanel = new JPanel();
      truckPanel = new JPanel();
      wheelsPanel = new JPanel();
      miscPanel = new JPanel();
     
      deckPanel.setBorder(BorderFactory.createTitledBorder("Select a Deck"));
      truckPanel.setBorder(BorderFactory.createTitledBorder("Select a Truck"));
      wheelsPanel.setBorder(BorderFactory.createTitledBorder("Select Wheels"));
      miscPanel.setBorder(BorderFactory.createTitledBorder("Select Accessories"));
     
      deckPanel.add(deckList);
      truckPanel.add(truckList);
      wheelsPanel.add(wheelsList);
      miscPanel.add(miscList);
     
      centerPanel = new JPanel();
      centerPanel.setLayout(new GridLayout(1,4));
     
      centerPanel.add(deckPanel);
      centerPanel.add(truckPanel);
      centerPanel.add(wheelsPanel);
      centerPanel.add(miscPanel);
     
     
       
    }

  


public void buildSouthPanel()
    {
        calcButton = new JButton("Calculate");
        exitButton = new JButton ("Exit");
        exitButton.addActionListener(new exitButtonListener());
        southPanel = new JPanel();
        southPanel.add(calcButton);
        southPanel.add(exitButton);
       
   
       
       
      
       
       
    }
   

    private class exitButtonListener implements ActionListener
    {
       
        public void actionPerformed(ActionEvent e)
        {
            System.exit(0);
           
           
        }
    }
   public static void main (String[] args)
   {
       new Skateboard();
      
      
      
    }
}

Decks

Truck Assemblies

Wheels

The Master Thrasher $ 60

7.75- inch axle $ 35

51 mm $ 20

The Dictator $ 45

8- inch axle $ 40

55 mm $ 22

The Street King $ 50

8.5- inch axle $ 45

58 mm $ 24

61 mm $ 28

Explanation / Answer

Dear.. import javax.swing.*; import javax.swing.event.*; import java.awt.*; public class DeckPanel extends JPanel { private JPanel deckPanel; private JList deckList; private JList selectedDeckList; private String[] decks = {"The Master Trasher" , "The Dictator", "The Street King"}; public DeckPanel() { setBorder(BorderFactory.createTitledBorder("Decks")); setLayout(new GridLayout(3, 1)); } } // AssembliesPanel public class AssembliesPanel extends JPanel { public final double AXLE1 = 35.00; public final double AXLE2 = 40.00; public final double AXLE3 = 45.00; private JCheckBox axle1; private JCheckBox axle2; private JCheckBox axle3; public AssembliesPanel() { setLayout(new GridLayout(3, 1)); axle1 = new JCheckBox("7.75 inch axle"); axle2 = new JCheckBox("8 inch axle"); axle3 = new JCheckBox("8.5 inch axle"); setBorder(BorderFactory.createTitledBorder("Truck Assemblies")); add(axle1); add(axle2); add(axle3); } } // WheelsPanel: public class WheelsPanel extends JPanel { public final double WHEEL1 = 20.0; public final double WHEEL2 = 22.00; public final double WHEEL3 = 24.00; public final double WHEEL4 = 28.00; private JRadioButton wheel1; private JRadioButton wheel2; private JRadioButton wheel3; private JRadioButton wheel4; private ButtonGroup bg; public WheelsPanel() { setLayout(new GridLayout(4, 1)); wheel1 = new JRadioButton("51 mm", true); wheel2 = new JRadioButton("55 mm"); wheel3 = new JRadioButton("58 mm"); wheel4 = new JRadioButton("61 mm"); bg = new ButtonGroup(); bg.add(wheel1); bg.add(wheel2); bg.add(wheel3); bg.add(wheel4); setBorder(BorderFactory.createTitledBorder("Wheels")); add(wheel1); add(wheel2); add(wheel3); add(wheel4); } } // MiscellaneousPanel public class MiscellaneousPanel extends JPanel { public final double TAPE = 10.0; public final double BEARINGS = 30.00; public final double PADS = 2.00; public final double NUTS = 28.00; private JRadioButton tape; private JRadioButton bearings; private JRadioButton pads; private JRadioButton nuts; private ButtonGroup bg; public MiscellaneousPanel() { setLayout(new GridLayout(4, 1)); tape = new JRadioButton("Grip Tape", true); bearings = new JRadioButton("Bearings"); pads = new JRadioButton("Riser Pads"); nuts = new JRadioButton("Nuts & Bolts Kit"); bg = new ButtonGroup(); bg.add(tape); bg.add(bearings); bg.add(pads); bg.add(nuts); setBorder(BorderFactory.createTitledBorder ("Miscellaneous Products")); add(tape); add(bearings); add(pads); add(nuts); } } public class OrderCalculatorGUI extends JFrame { private final int WINDOW_WIDTH = 400; private final int WINDOW_HEIGHT = 200; private DeckPanel decks; // Deck panel private AssembliesPanel assemblies; private WheelsPanel wheels; private MiscellaneousPanel miscellaneous; private JPanel buttonPanel = new JPanel(); private JButton calcButton; private JButton exitButton; private final double TAX_RATE = 0.06; public OrderCalculatorGUI() { setTitle("Skateboard Designer"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(WINDOW_WIDTH, WINDOW_HEIGHT); setLayout(new GridLayout(3, 4)); miscellaneous = new MiscellaneousPanel(); decks = new DeckPanel(); assemblies = new AssembliesPanel(); wheels = new WheelsPanel(); buildButtonPanel(); add(decks); add(assemblies); add(wheels); add(miscellaneous); add(buttonPanel); pack(); setVisible(true); } private void buildButtonPanel() { calcButton = new JButton("Calculate"); exitButton = new JButton("Exit"); buttonPanel.add(calcButton); buttonPanel.add(exitButton); } private class ExitButtonListener implements ActionListener { public void actionPerformed(ActionEvent e) { System.exit(0); } } } // DeckPanel public class DeckPanel extends JPanel implements ListSelectionListener { private JPanel deckPanel; private JList deckList; String[] decks = {"The Master Trasher" , "The Dictator", "The Street King"}; public DeckPanel() { setBorder(BorderFactory.createTitledBorder("Decks")); deckList = new JList(decks); add(deckList); JScrollPane scrollbar = new JScrollPane(deckList); scrollbar.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); scrollbar.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); add(scrollbar); deckList.setVisibleRowCount(2); deckList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); deckList.addListSelectionListener(this); setLayout(new GridLayout(3, 1)); } public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { String selection = (String) deckList.getSelectedValue(); System.out.println(selection); } } }

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