1 /** 2 * @author 冰樱梦 3 * 时间:2018年下半年 4 * 题目:英尺和米之间的转换 5 * 6 */ 7 public class Exercise06_09 { 8 public static void main(String[] args){ 9 System.out.printf("%-28s%-28s%-26s%-10s","英尺","米","米","英尺"); 10 System.out.println("\n————————————————————————————————————————————————"); 11 for(double i=1,j=20;i<=10&&j<=65;i++,j+=5){ 12 System.out.printf("%-10.1f%-10.3f%-10.1f%.3f\n",i,footToMeter(i),j,meterToFoot(j)); 13 } 14 15 } 16 public static double footToMeter(double foot){ 17 return 0.305*foot; 18 } 19 public static double meterToFoot(double meter){ 20 return 3.279*meter; 21 } 22 }
原文地址:https://www.cnblogs.com/cherrydream/p/10173798.html
时间: 2024-11-05 19:30:36