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