viewing paste LinearConversion | Java

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
public  class   LinearConversion{
    public  static  void    main(String[] args){
        int i;
        double n;
        System.out.println("Feet | Meters");
        for(i = 1; i <= 10; i++){
            n = footToMeter(i);
            System.out.printf(i+" |  %.3f%n", n);
        }
        System.out.println("\nMeters | Feet");
        for(i = 20; i <= 65; i++){
            n = meterToFoot(i);
            System.out.printf(i+" |  %.3f%n", n);
        }
    }
    public  static  double  footToMeter(double foot){
        return(0.3048*foot);
    }
    public  static double meterToFoot(double meter){
        return(3.28084*meter);
    }
}
Viewed 1319 times, submitted by Streusel.