All,
Hello...I am extremely new to the java scene, I am working on my first assignment in my java class. My problem is I cannot get my input in String Degrees to calculate and then display my the degrees entered. The input box comes up from String Degrees and allows for an input of data, but then disappears when you click ok and nothing happens. but after this if I type the degrees into the CMD Prompt it calculates and displays the second Message box with the answer. I need it to on click ok calculate using the formula and then automatically display the answer. I Would extremely appreciate a lil nudge in the right direction considering this is due tonight. Stupid Vista took me a 3 Days to figure out how to get JAVAC to compile anything in Vista. Thanks in advance for all of your help.
import java.util.Scanner; //program that uses a class scanner import java.lang.Double; import javax.swing.JOptionPane; //Dialog Boxes //program that converts Farenheit to Celsius public class DegreeCalculation { public static void main( String args[] ) { Scanner input = new Scanner( System.in ); double number1; double sum; //User Enters Degrees String degrees= JOptionPane.showInputDialog("Input Degrees in Farenhiet:"); number1 = input.nextDouble(); //reads the first number double number2 = Double.parseDouble(degrees); sum = (number2 - 32) * (5.0 / 9); //Prints Message containing conversion String message= String.format("Sum is: %.15f\n", sum); JOptionPane.showMessageDialog(null, message); } //end method main } //end class DegreeCalculation