Jump to content
  • 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 5457 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

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!