CS 1401 Homework #3

Date Assigned: Tuesday, February 1, 2005

Due Date: Thursday, February 3, 2005, before the beginning of your lecture section.

Goal: the goal of this assignment is to learn how to deal with numbers in Java.

Assignment:
Write a piece of code that asks the user for a temperature in Celsius and returns the corresponding temperature in Fahrenheit. The corresponding formula is Fahrenheit = (9/5) Celsius + 32. Take into account that the temperature is not always an integer, e.g., in Celsius, the prefect body temperature is 36.6.

Trace your code on an example of 100 degrees Celsius, which should result in 212 degrees F.

Explain what happens if you literally write (9/5) in the corresponding Java code.

Explain what happens if you literally write (9/5) Celsius in the corresponding Java code.