123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- public class ConversionTool {
-
- public static void main(String[] args){}
-
- public static float CentimetersToInches(float centimeters){
- float inches = (float)(0.393701 * centimeters);
- if (inches < 0){
- return 0;
- } else{
- return inches;
- }
- }
-
- public static float InchesToCentimeters(float inches){
- float centimeters = (float) (inches * 2.54);
- if (centimeters < 0){
- return 0;
- } else{
- return centimeters;
- }
- }
-
- public static float FeetToMeters(float feet){
- float meters = (float)(feet * 0.3048);
- if (meters < 0){
- return 0;
- } else{
- return meters;
- }
- }
-
- public static float MetersToFeet(float meters){
- float feet = (float)(meters * 3.28084);
- if (feet < 0){
- return 0;
- } else{
- return feet;
- }
- }
-
- public static float CelsiusToFahrenheit(float celsius){
- float f = (int)(celsius * 9/5 + 32);
- return f;
- }
-
- public static float FahrenheitToCelsius(float fahrenheit){
- float c = (float) ((fahrenheit - 32) / 1.8);
- return c;
- }
-
- public static float MphToKph(float mph){
- float kph = (float)( mph * 1.60934);
- if (kph < 0){
- return 0;
- } else{
- return kph;
- }
- }
-
- public static float KphToMph(float kph){
- float mph = (float)(kph * 0.621371);
- if (mph < 0){
- return 0;
- } else{
- return mph;
- }
- }
- }
|