HW5.8

HW5.8

 public class Solution
 {
     public static void main(String[] args)
     {
         System.out.printf("%s\t%s\t%s\t%s\n", "Celsius", "Fahrenheit", "Fahrenheit", "Celsius");

         for(double i = 40, j = 120; i >= 31 && j >= 30; i--, j -= 10)
             System.out.printf("%.1f\t%.2f\t%.1f\t%.2f\n", i, celsiusToFahrenheit(i), j, fahrenheitToCelsius(j));
     }

     public static double celsiusToFahrenheit(double celsius)
     { return (9.0 / 5) * celsius + 32; }

     public static double fahrenheitToCelsius(double fahrenheit)
     { return (5.0 / 9) * (fahrenheit - 32); }
 }
上一篇:NodeJS:树的序列化


下一篇:keybd_event跟SendMessage,PostMessage模拟键盘消息的区别 z