This program consists of one function in one class. It uses to demonstrate how primitive data types are implemented in Java.

Hi Dani,
fine Examples (the others too) to learn programming Java, but where is the class?


package farenheittocelcius;
public class FarenheitToCelcius {
public static void main(String args[])
double farenheit, celcius = 0;
System.out.println("\n\tPlease enter temp. in farenheit: ");
farenheit = MyInput.readDouble();
celcius = (5/9)*(farenheit-32);
System.out.println("\n\tThat is " + celcius + " degrees celcius.");

I had to do this same program for a homework assignment, except we had to do celcius to fahrenheit.

Hi, looking at your code, I can see only 0 as answer

When you do 5/9, your dealing with ints, so thats 0.

I think you should do 5.0/9 or 5/9.0 or (double)5/9 or 5/(double)9, or or just 0.55555555555555555