I'm trying to create a simple program that converts degrees in Fahrenheit to degrees in Celcius on my mac through the Terminal application and using the vi editor.
My code is as follows:
import java.io.*;
public class MyThirdJavaProgram
{
public static void main (String [] args)
{
double celcius, fahrenheit;
fahrenheit = Console.readDouble("fahrenheit");
celcius = convertFahrenheitToCelcius(fahrenheit);
System.out.println("Degrees in celcius are " + celcius);
}
private static double convertFahrenheitToCelcius (double ins)
{
double celcius;
celcius = ((ins-32.0)*5.0)/9.0;
return celcius;
}
}
The error I keep getting is:
MyThirdJavaProgram.java:7: cannot find symbol
symbol : method readDouble(java.lang.String)
location: class java.io.Console
fahrenheit = Console.readDouble("fahrenheit");
^
What am i doing wrong here? I've tried a lot of different ways to code it such as
fahrenheit = Console.in.readDouble(fahrenheit)
and
fahrenheit = System.console.readDouble(fahrenheit)
but absolutely nothing works and the error statement is almost the same every time. I'm very new to java but this is just confusing the heck out of me. Any help that solves this dang thing would be awesome, even if you tell me to re-write half of it.