public class TemperatureConverter
{
//-----------------------------------------------------------------
// change the Fahrenheit equivalent of a specific Celsius
//-----------------------------------------------------------------
public static void main (String[] args)
{
final int BASE = 32;
final double CONVERSION_FACTOR = 9.0 / 5.0;
double fahrenheitTemp;
int celsiusTemp = 24; // value to convert
fahrenheitTemp = celsiusTemp * CONVERSION_FACTOR + BASE;
System.out.println ("Celsius Temperature: " + celsiusTemp);
System.out.println ("Fahrenheit Equivalent: " + fahrenheitTemp);
}
}
GO TO CHAPTER 3
Browse: Home > scanner function (celsius convert to fahrenheit )
0 Comments:
Post a Comment