Hi all. Ron here. It's been a few weeks. I hope everyone is well.
What I have here is part of a program I'm working on. What I'm doing at this point is converting a Fahrenheit temperature to Celsius. Simple enough, but every time I run this thing, it keeps returning -0.0, no matter what. I can't figure out if it's the way I've keyed the formula or if I've done something wrong with the methods. Anyone care to chime in?
import javax.swing.JOptionPane; public class Celsius { public static void main(String[] args) { String input; double fahrenTemp; fahrenTemp = getFahren(); convertTemp(fahrenTemp); System.exit(0); } public static double getFahren() { String input = JOptionPane.showInputDialog("Please enter a Fahrenheit temperature from 0 to 10 " + "and I will convert it to Celsius for you."); double fahrenTemp = Double.parseDouble(input); return fahrenTemp; } public static void convertTemp(double fahrenTemp) { double toCelsius = (5 / 9) * (fahrenTemp - 32); JOptionPane.showMessageDialog(null, "That would be " + toCelsius + " degrees Celsius."); } }