Need a little help
I need some help with an assignment for my Java Programming class.
Write a program that reads a Fahrenheit degree in double from an input dialog box, then converts it to Celsius and displays the result in a message dialog box. The formula for the conversion is as follows: celsius = (5/9) * (fahrenheit - 32)
Hint: In Java 5/9 is 0, so you need to write 5.0/9 in the program to obtain the correct result.
Here is my code:
import javax.swing.JOptionPane;
public class Convert{
public static void main(String[]args){
int fahrenheit;
double celsius;
//Formula to convert Fahrenheit to Celsius
celsius = (5.0/9) * (fahrenheit -32);
// Prompt user to enter degrees Fahrenheit
JOptionPane.showInputDialog("Enter degrees Fahrenheit");
//Display converted output
JOptionPane.showMessageDialog(fahrenheit + "degrees Fahrenheit = " + celsius + " degress Celsius");
}
}
My original code was slightly different but didn't work either. I've been playing around with this literally for hours and I'm going crazy. Basically I figured out how to get the input box to pop up but I can't figure out how or where to plug the conversion formula in or make it work properly.
The error I get with that code is:
--jGRASP exec: javac -g C:\Program Files\jGRASP\projects\Convert.java
Convert.java:22: cannot resolve symbol
symbol : method showMessageDialog (java.lang.String)
location: class javax.swing.JOptionPane
JOptionPane.showMessageDialog(fahrenheit + "degrees Fahrenheit = " + celsius + " degress Celsius");
^
1 error
--jGRASP wedge2: exit code for process is 1.
--jGRASP: operation complete.
Any help here would really be appreciated. Its probably something simple that I'm overlooking but I'm not exactly good at programming and my teacher and textbook don't help much either.

