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