// Burton Rosenberg // Tue Feb 3 1998 // Temperature.java import java.io.* ; class Temperature { public static void main( String [] argv ) throws IOException { BufferedReader stdin = new BufferedReader (new InputStreamReader(System.in)) ; System.out.print("Convert to (Celcius/Farenheit)? ") ; String answer ; answer = stdin.readLine() ; System.out.print("Temperature: " ) ; double x ; x = (Double.valueOf(stdin.readLine())).doubleValue() ; if ( answer.equals("Celcius") ) { System.out.print( x + " Farenheit = " ) ; System.out.print( farenheitToCelcius(x) + " Celcius." ) ; } else { System.out.print( x + " Celcius = " ) ; System.out.print( celciusToFarenheit(x) + " Farenheit." ) ; } System.out.println() ; } static double celciusToFarenheit( double c ) { return (c*9.0/5.0 + 32.0) ; } static double farenheitToCelcius( double f ) { return (f-32.0)*5.0/9.0 ; } }