This topic is now archived and is closed to further replies.


Why is this equation not working? it's a really simple equation too...

Recommended Posts

public double fahrenheitToCelsius() { double answer = (number - 32); answer *= 5/9; return answer; } here''s the code for the other class. keyboard is another class that just simplifies getting input from the terminal: System.out.print("Enter a number: "); // prompts the user for a number double myNumber = Keyboard.readDouble();// reads the number from the keyboard // using the readDouble() method of // the Keyboard class System.out.println(myNumber + " degrees fahrenheit is " + thisMyClass.fahrenheitToCelsius() + " degrees celsius"); No matter what value is inputted, i get 0.0 or -0.0 as the result.

Share this post

Link to post
Share on other sites