12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- public class ConversionTool {
-
- public static void main(String[] args){}
-
- public static float CentimetersToInches(float centimeters){
- float inches;
- if (centimeters>0)
- {
- inches = centimeters/(float)2.54;
- } else
- {
- inches = 0;
- }
- return inches;
- }
-
- public static float InchesToCentimeters(float inches){
- float centimeters;
- if (inches>0)
- {
- centimeters = inches*(float)2.54;
- } else
- {
- centimeters = 0;
- }
- return centimeters;
- }
-
- public static float FeetToMeters(float feet){
- float meters;
- if (feet>0)
- {
- meters = feet/(float)3.2808;
- } else
- {
- meters = 0;
- }
- return meters;
- }
-
- public static float MetersToFeet(float meters){
- float feet;
- if (meters>0)
- {
- feet = meters*(float)3.2808;
- } else
- {
- feet = 0;
- }
- return feet;
- }
-
- 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){
- float kph;
- if (mph>0)
- {
- kph = mph*(float)1.6093440;
- } else
- {
- kph = 0;
- }
- return kph;
- }
-
- public static float KphToMph(float kph){
- float mph;
- if (kph>0)
- {
- mph = kph/(float)1.6093440;
- } else
- {
- mph = 0;
- }
- return mph;
- }
- }
|