SHARING KNOWLEDGE EACH OTHERS!

Wednesday, December 31, 2008

scanner function (celsius convert to fahrenheit )


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

Stumble
Delicious
Technorati
Twitter
Facebook

0 Comments:

Post a Comment

Enter your email address:

 

SOFTWARES AND PLATFORMS Copyright © 2010 LKart Theme is Designed by Lasantha