1 public class Solution 2 { 3 public static void main(String[] args) 4 { 5 System.out.printf("%s\t%s\t%s\t%s\n", "Inch", "Meter", "Meter", "Inch"); 6 7 for(double i = 1, j = 20; i <= 10 && j <= 65; i++, j += 5) 8 System.out.printf("%f\t%f\t%f\t%f\n", i, footToMeter(i), j, meterToFoot(j)); 9 } 10 11 public static double footToMeter(double foot) 12 { return foot / 0.305; } 13 14 public static double meterToFoot(double meter) 15 { return meter * 0.305; } 16 }
时间: 2024-10-21 12:57:21