Due: Monday, September 10
Goal: Explore arithmetic operations and issues with integer division
Here is the formula to convert a temperature from fahenheit to celsius:
celsius = (fahrenheit - 32) * 5⁄9
Write a Java program that makes two int variables, one for celsius and one for
fahrenheit. Set fahrenheit to 100.
Your program should then compute the temperature in celsius and output it.
First use this formula:
celsius = (fahrenheit - 32) * (5 / 9);
Second, use this formula:
celsius = 5 * (fahrenheit - 32) / 9;
You should get different results. Why? How could you fix the first one to get the correct result?
Show your program to your instructor or email it to kenrick@uaa.alaska.edu with an explanation to the behavior and the fix by the end of the day for full credit.