Hi All,
I have been working on this all night. I have to convert degrees to celcius and vice versa. I keep having 2 errors. "possible loss of precision". I am new to java, but also I think I am having serious mental issues at this point.
Here is my code:
import java.util.*;
public class weather
{
static Scanner console = new Scanner(System.in);
public static void main(String[] arguments)
{
float fah = 86;
System.out.println(fah + " %.2f degrees Fahrenheit is ..."); // To convert Fahrenheit into Celsius
fah = (fah - 32); // Begin by subtracting 32
fah = (fah / 9.0); // Divide the answer by 9
fah = (fah * 5.0); // Multiply that answer by 5
System.out.println(fah + " degrees Celsius\n");
float cel = 33;
System.out.println(cel + " degrees Celsius is ..."); // To convert Celsius into Fahrenheit
cel = cel * 9; // Begin by multiplying it by 9
cel = cel / 5; // Divide the answer by 5
cel = cel + 32; // Add 32 to the answer
System.out.println(cel + " degrees Fahrenheit");
}
}
Thanks