# Help With Temperature Converter (Beginner).

• July 22nd, 2014, 11:29 PM
regsterbear
Help With Temperature Converter (Beginner).
Hi there.
Am just starting out with java and am having trouble to get this code to work. Its one of my exercises in my course and I've been trying to find a way to get it to work for a bit now (knowing me it will be something obvious i have overlooked). I can't seem to get the variable celsius into the convert method in order to proceed. I have been playing around but what I've tried doesn't seem to complete compilation. Any ideas would be greatly appreciated.

This is my first forum post and apologise in advance if formatting etc isn't correct.

Thanks.

Code Java:

```import java.util.Scanner;   public class FahrenheitToCelsius{   public static void main(String[]args){ convertFToC(); } public static void convertFToC(){ Scanner scan = new Scanner(System.in); System.out.println("Enter Fahrenheit temperature"); double fahrenheit = scan.nextDouble(); System.out.println(fahrenheit + " degrees Fahrenheit is" + celsius + "degrees Celsius"); } public static double toCelsius (double fahr){ final int BASE = 32; final double CONVERSION_FACTOR = 9.0 / 5.0; final double CEL_CONVERSION_FACTOR = 5.0 / 9.0; double celsius = fahr * CEL_CONVERSION_FACTOR - BASE; return celsius;   }   }```
• July 23rd, 2014, 02:59 AM
GregBrannon
Re: Help With Temperature Converter (Beginner).
Welcome to the forum! Thanks for taking the time to learn how to post code correctly. If you haven't already, please read this topic to learn other useful info for new members.

At some point before the result is presented, you'd 'call' the toCelsius() method with the user's input:

double celsius = toCelsius( fahrenheit );
• July 23rd, 2014, 08:06 PM
regsterbear
Re: Help With Temperature Converter (Beginner).
Thanks for the help. Appreciate it a lot :)
• July 24th, 2014, 04:22 AM
GregBrannon
Re: Help With Temperature Converter (Beginner).
You're welcome.