I'm trying to write a program that converts temperatures expressed in degree Fahrenheit to degree Celsius. The user enters a Fahrenheit value and the program prints out the Celsius value. The user is supposed to enter 212 as the Fahrenheit value the program is supposed to calculate 100.0 as the Celsius value but instead I'm getting 0.0 as the Celsius value when I want to get 100.0
I'm not sure where the problem might be. Is it possibility the order of operations?
The formula for converting Celsius to Fahrenheit is : C = 5 / 9 (F - 32)
import acm.program.*;
public class FahrenheitToCelsius extends ConsoleProgram {
public void run() {
println("This program converts Fahrenheit to Celsius");
int fah = readInt("Enter Fahrenheit temperature: ");
double ft = 5 / 9;
double cel = ft * (fah - 32);
println("Celsius equivalent = " + cel);
}
}