• Advertisement


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

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

This topic is 5244 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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

  • Advertisement