From d804d0ebc6e7e80c573c1593e4f16b58c6d0b39c Mon Sep 17 00:00:00 2001 From: Byung-Chun Yoo Date: Fri, 12 May 2017 11:25:03 -0400 Subject: [PATCH] completed the conversion tools --- .idea/.name | 1 + .idea/compiler.xml | 18 +------ .idea/copyright/profiles_settings.xml | 3 -- .idea/encodings.xml | 6 --- .idea/kotlinc.xml | 7 +++ .idea/misc.xml | 49 ++++++++++++----- .idea/vcs.xml | 6 +++ conversion.iml | 3 +- src/main/java/ConversionTool.java | 52 +++++++++++++------ target/classes/ConversionTool.class | Bin 1471 -> 1212 bytes target/test-classes/ConversionToolSpec.class | Bin 3584 -> 3584 bytes 11 files changed, 88 insertions(+), 57 deletions(-) create mode 100644 .idea/.name delete mode 100644 .idea/copyright/profiles_settings.xml delete mode 100644 .idea/encodings.xml create mode 100644 .idea/kotlinc.xml create mode 100644 .idea/vcs.xml diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000..5966089 --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +conversion \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml index 3c5f7fa..7ec525c 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -1,27 +1,11 @@ - - - - - - - - - - - - - - - - + - diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml deleted file mode 100644 index e7bedf3..0000000 --- a/.idea/copyright/profiles_settings.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml deleted file mode 100644 index 97626ba..0000000 --- a/.idea/encodings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml new file mode 100644 index 0000000..1c24f9a --- /dev/null +++ b/.idea/kotlinc.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index dfca8c4..0f82c90 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,8 +1,5 @@ - - - - - - - - - - - - - - + + + + + + + + + + + 1.8 + + + + + 1.8 @@ -37,6 +47,17 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/conversion.iml b/conversion.iml index 4b044f1..0ddf51c 100644 --- a/conversion.iml +++ b/conversion.iml @@ -1,11 +1,10 @@ - + - diff --git a/src/main/java/ConversionTool.java b/src/main/java/ConversionTool.java index df73653..0de6d2c 100644 --- a/src/main/java/ConversionTool.java +++ b/src/main/java/ConversionTool.java @@ -3,19 +3,41 @@ public class ConversionTool { public static void main(String[] args){} - public static float CentimetersToInches(float centimeters){} - - public static float InchesToCentimeters(float inches){} - - public static float FeetToMeters(float feet){} - - public static float MetersToFeet(float meters){} - - public static float CelsiusToFahrenheit(float celsius){} - - public static float FahrenheitToCelsius(float fahrenheit){} - - public static float MphToKph(float mph){} - - public static float KphToMph(float kph){} + public static float CentimetersToInches(float centimeters){ + if(centimeters <= 0) return 0; + else return centimeters / 2.54f; + } + + public static float InchesToCentimeters(float inches){ + if(inches <= 0) return 0; + else return inches * 2.54f; + } + + public static float FeetToMeters(float feet){ + if (feet <= 0) return 0; + else return feet * 0.3048f; + } + + public static float MetersToFeet(float meters){ + if(meters <= 0) return 0; + else return meters / 0.3048f; + } + + public static float CelsiusToFahrenheit(float celsius){ + return (celsius * 9 / 5) + 32f; + } + + public static float FahrenheitToCelsius(float fahrenheit){ + return (fahrenheit - 32f) * 5f / 9f; + } + + public static float MphToKph(float mph){ + if(mph <= 0) return 0; + else return mph * 1.609344f; + } + + public static float KphToMph(float kph){ + if (kph <= 0) return 0; + else return kph / 1.609344f; + } } diff --git a/target/classes/ConversionTool.class b/target/classes/ConversionTool.class index 7d20ebc7517733b6c814cac4fcef422936d99bfb..a67a98788c503254ff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