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