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