hi all. i need to write an application class with a main method and a second method called tempCalc, and then in the second method put the code from a previouse temperature calculation experiment. but i have no idea how to do this. i read the part in "Sams Teach Yourself Java2 in 21 days" about methods and calling methods but i cant get this working. please help me.

this is the tempCalc.java

import javax.swing.JOptionPane;


public class tempCalc
{


public static void main (String[]args)


{


String inString = JOptionPane.showInputDialog("Enter degrees Fahrenheit");


double fahrenheit = Double.parseDouble(inString);
double num1 = 5;
double num2 = 9;
double num3 = 32;


double num4 = ((num1/num2) * (fahrenheit - num3))  ;


System.out.println("Degrees in Celsius is (" +num4+ ")");


System.exit (0);


}


} 

any help, even a finger pointing in the direction of a tutorial would help. im just quite stumped here.
thankyou.

I'm not sure if I understand correctly, but here it goes anyway.
I think your saying that you want to call a method into your main method which is in the tempcalc.class.

If this is what you want then say your method that you want to call is caculateTemp and it has no arguments then you would
insert caculateTemp(); where you wanted to execute that method. If the method contains arguments then you would
insert caculateTemp(your arguments here);

I probably confused you more, but I hope this helps instead.

Good Luck

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.