Getting error with the following code:
import java.util.Scanner;
public class FahrenheitToCelsius{
public static void main(String[]args){
convertFToC();
}
/*gets input representing fahrenheit and displays celsius equivalent*/
public static void convertFToC(){
Scanner scan = new Scanner(System.in);
System.out.println("Enter Fahrenheit temperature");
double fahrenheit = scan.nextInt();
System.out.println(fahrenheit + " degrees Fahrenheit is " +
fMethod(celsius) + " degrees Celsius");
}
/* calculates and returns the celsius equivalent */
public static double toCelsius(double fahr){
int BASE = 32;
double CONVERSION_FACTOR = 9.0/ 5.0;
double celsius = ((fahr-BASE)/(CONVERSION_FACTOR));
return celsius;
}
}
I get the following:
Error: celsius cannot be resolved to a variable
I need to use fMethod
to call the toCelsius
in the System.out.println
however i keep getting this error.