123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. public class ConversionTool {
  2. public static void main(String[] args){}
  3. public static float CentimetersToInches(float centimeters){
  4. if(centimeters >= 0){
  5. return centimeters / 2.54f;}
  6. else {return 0;}
  7. }
  8. public static float InchesToCentimeters(float inches){
  9. if(inches >= 0){
  10. return inches * 2.54f;}
  11. else {return 0;}
  12. }
  13. public static float FeetToMeters(float feet){
  14. if(feet >= 0){
  15. return feet * .3048f;}
  16. else {return 0;}
  17. }
  18. public static float MetersToFeet(float meters){
  19. if(meters >= 0){
  20. return meters * 3.28084f;}
  21. else {return 0;}
  22. }
  23. public static float CelsiusToFahrenheit(float celsius){
  24. return celsius * 9/5 + 32;
  25. }
  26. public static float FahrenheitToCelsius(float fahrenheit){
  27. return (fahrenheit - 32) * 5/9;
  28. }
  29. public static float MphToKph(float mph){
  30. if(mph >= 0){
  31. return mph * 1.609344f;}
  32. else {return 0;}
  33. }
  34. public static float KphToMph(float kph){
  35. if(kph >= 0){
  36. return kph / 1.609344f;}
  37. else {return 0;}
  38. }
  39. }