New to java stop need help stop
This is probably a very easy fix but then again, I'm very new to programming. Please send help.
import java.util.Scanner;
public class FahrenheitToCelsius {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Enter a degree in Fahrenheit: ");
double fahrenheit = input.nextDouble();
//Convert Fahrenheit to Celsius
double celcius = (5.0 / 9) * (fahrenheit - 32);
System.out.println("Fahrenheit " + fahrenheit + " is " +
celsius + " in Celsius");
}
}
FahrenheitToCelsius.java:13: error: cannot find symbol
celsius + " in Celsius");
^
symbol: variable celsius
location: class FahrenheitToCelsius
1 error
Re: New to java stop need help stop
You get a "cannot find symbol" for a variable if you have not declared it, or if you have made a spelling mistake.
Re: New to java stop need help stop
Quote:
Originally Posted by
Skrap09
This is probably a very easy fix but then again, I'm very new to programming. Please send help.
import java.util.Scanner;
public class FahrenheitToCelsius {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Enter a degree in Fahrenheit: ");
double fahrenheit = input.nextDouble();
//Convert Fahrenheit to Celsius
double celcius = (5.0 / 9) * (fahrenheit - 32);
System.out.println("Fahrenheit " + fahrenheit + " is " +
celsius + " in Celsius");
}
}
FahrenheitToCelsius.java:13: error: cannot find symbol
celsius + " in Celsius");
^
symbol: variable celsius
location: class FahrenheitToCelsius
1 error
When you declared the double "celcius" you spelled it with a "c" in the middle. However when you print this to the console you have spelled it "celsius" with an "s" in the middle. Change the double declaration from "celcius" into "celsius" and it should then work :)
Regards Serb.
Re: New to java stop need help stop
Lol good eye, I looked up the error message but i guess I overlooked it by a smidgen. Thanks!