public class ConversionTool { public static void main(String[] args){ } public static float CentimetersToInches(float centimeters){ if(centimeters > 0){ return centimeters * (float) 0.393701; } return 0; } public static float InchesToCentimeters(float inches){ if(inches > 0){ return inches / (float) 0.393701; } return 0; } public static float FeetToMeters(float feet){ if (feet > 0){ return feet * (float) 0.3048; } return 0; } public static float MetersToFeet(float meters){ if (meters > 0){ return meters / (float) 0.3048; } return 0; } public static float CelsiusToFahrenheit(float celsius){ return (celsius * (float)1.8) + 32; } public static float FahrenheitToCelsius(float fahrenheit){ return (fahrenheit - 32) / (float)1.8; } public static float MphToKph(float mph){ if (mph > 0){ return mph * (float) 1.60934; } return 0; } public static float KphToMph(float kph){ if (kph > 0){ return kph / (float) 1.60934; } return 0; } }