//Author: Ben Padula
//File name: convert.js
//Date last modified: 10/16/01

function fahrToCelsius(tempInFahr)
    // Assumes: tempInFahr is a temperature in fahrenheit
    // Returns: the equivalent temperature in celsius
    {
        return (5/9) * (tempInFahr - 32);
    }

function celsiusToFahr(TempInCelsius)
    //Assumes: tempInCelsius is a temperature in celsius
    //Returns: the equivalent temperature in fahrenheit
    {
        return ((9/5 * TempInCelsius) + 32);
     }

function inchToCm(inchLength)
    {
        return (inchLength * 2.54);
    }

function cmToInch(cmLength)
    {
       return (cmLength/2.54);
    }

function feetToMeters(feet)
    {
        var inches, centimeters;
        //Since there are 12 inches in a foot
        inches = (12 * feet);
        centimeters = inchToCm(inches);
        //Since there are 100cm in a meter
        
        return (centimeters/100);
    }

function metersToFeet(meters)
    {
        var centimeters, inches;
        //Since one meter is 100 centimeters
        centimeters = (100 * meters);
        inches = cmToInch(centimeters);
        //Since one foot is 12 inches
        
        return (inches/12);
    }

function milesToKm(miles)
    {
        var feet, meters;
        //Since one mile is 5280 feet
        feet = (5280 * miles);
        meters = feetToMeters(feet);
        //Since one kilometer is 1000 meters
        
        return (meters/1000)
     }
     
function kmToMiles(kilometers)
     {
         var meters, feet;
         //Since one kilometer is 1000 meters
         meters = (1000 * kilometers);
         feet = metersToFeet(meters);
         //Since one mile is 5280 feet
         
         return (feet/5280)
      }



