Fahrenheit to Celsius conversion yields only 0.0 and -0.0

后端 未结 5 1941
不思量自难忘°
不思量自难忘° 2020-12-02 01:06

I\'m on the 8th chapter (Methods, Constructors, and Fields) of my Java methods book and I\'m having a problem with one of my exercises.

The provided code is Tempera

5条回答
  •  佛祖请我去吃肉
    2020-12-02 01:44

    In integer math (5 / 9) = 0.

    and (degrees - 32) * (5 / 9); will always be 0 you need to use doubles or something.

提交回复
热议问题