ConversionTool.java 860B

123456789101112131415161718192021222324252627282930313233343536373839
  1. public class ConversionTool {
  2. public static void main(String[] args){}
  3. public static float CentimetersToInches(float centimeters){
  4. return centimeters * (float)0.393701;
  5. }
  6. public static float InchesToCentimeters(float inches){
  7. return inches * (float)2.54;
  8. }
  9. public static float FeetToMeters(float feet){
  10. return feet * (float)0.3048;
  11. }
  12. public static float MetersToFeet(float meters){
  13. return meters * (float)3.28084;
  14. }
  15. public static float CelsiusToFahrenheit(float celsius){
  16. return celsius + (float)32;
  17. }
  18. public static float FahrenheitToCelsius(float fahrenheit){
  19. return fahrenheit - (float)32;
  20. }
  21. public static float MphToKph(float mph){
  22. return mph * (float)1.60934;
  23. }
  24. public static float KphToMph(float kph){
  25. return kph * (float)0.621371;
  26. }
  27. }