I could sure use some help. Here is what I have and it shows a problem which is :

 int tempCelcius = (int)((Double.parseDouble(tempTextField.getText()))
    (5 / 9) × (Fahrenheit – 32)); 

and here is all that I have:

/**
 *
 * @author TJ
 */
public class FahrenheitConverterGUI extends javax.swing.JFrame {

    /** Creates new form FahrenheitConverterGUI */
    public FahrenheitConverterGUI() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">
    private void initComponents() {

        tempTextField = new javax.swing.JTextField();
        fahrenheitLabel = new javax.swing.JLabel();
        convertButton = new javax.swing.JButton();
        celciusLabel = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("FehrenheitConverter");

        tempTextField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tempTextFieldActionPerformed(evt);
            }
        });

        fahrenheitLabel.setText("Fahrenheit");

        convertButton.setText("Convert");
        convertButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                convertButtonActionPerformed(evt);
            }
        });

        celciusLabel.setText("Celcius");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(tempTextField, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(convertButton, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(celciusLabel))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(fahrenheitLabel)))
                .addContainerGap(40, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(tempTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(fahrenheitLabel))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(convertButton)
                    .addComponent(celciusLabel))
                .addContainerGap(31, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>

    private void convertButtonActionPerformed(java.awt.event.ActionEvent evt) {                                         
       //Parse degrees Fahrenheit as a double and convert to Celcius.
    int tempCelcius = (int)((Double.parseDouble(tempTextField.getText()))
        (5 / 9) * (Fahrenheit – 32));
    fahrenheitLabel.setText(tempCelcius + "Celcius"); 
  }                                        

    private void tempTextFieldActionPerformed(java.awt.event.ActionEvent evt) {                                            
        // TODO add your handling code here:
    }                                           

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new FahrenheitConverterGUI().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify
    private javax.swing.JLabel celciusLabel;
    private javax.swing.JButton convertButton;
    private javax.swing.JLabel fahrenheitLabel;
    private javax.swing.JTextField tempTextField;
    // End of variables declaration

}

And your problem is?

There is a problem with:

int tempCelcius = (int)((Double.parseDouble(tempTextField.getText()))
(5 / 9) × (Fahrenheit – 32));

I am not sure what it is and would like for someone to explain it to me.
Thank you

Hi
Where did you get this code?

I think this is a home work question.

well,
First of all Java programmers usually use capital letters in the first letter for the class names
so if you see this line you should first see <<Fahrenheit>> which is started with capital letter.
There is no class Fahrenheit in this code neither any variable named with Fahrenheit.
I think they mean you should put this formula in the line so that you subtract 32 form "(int)((Double.parseDouble(tempTextField.getText()))" and multiply it by (5/9)
so all what you need is to do that and every thing will go right.

Yes I am working on homework and got the code from what the teacher gave us to use. I will try what you said and thank you for the reply.

You are not sure what is? Your not sure what that does, at all? or your not sure why it doesn't do what it is suppossed to?

Or is it that it "doesn't work" because you still have

private void tempTextFieldActionPerformed(java.awt.event.ActionEvent evt) {
    // TODO add your handling code here:
}

in your code?

This "(5 / 9)" is integer math and so will return "1". Is that what you want? No. You need to use at least one double in that part, either "5.0" or "9.0" (or both).

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.