From 2f3a1ae9104d1834ace4f6e0214ef3c0867bdc91 Mon Sep 17 00:00:00 2001 From: Rahmir Ford Date: Fri, 12 May 2017 23:02:35 -0400 Subject: [PATCH] Assignment complete and all unit tests passed --- .idea/vcs.xml | 6 +++ conversion.iml | 2 + src/main/java/ConversionTool.java | 69 ++++++++++++++++++++++++---- target/classes/ConversionTool.class | Bin 1471 -> 1530 bytes 4 files changed, 68 insertions(+), 9 deletions(-) create mode 100644 .idea/vcs.xml diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /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..400d910 100644 --- a/conversion.iml +++ b/conversion.iml @@ -13,5 +13,7 @@ + + \ No newline at end of file diff --git a/src/main/java/ConversionTool.java b/src/main/java/ConversionTool.java index df73653..22ce713 100644 --- a/src/main/java/ConversionTool.java +++ b/src/main/java/ConversionTool.java @@ -1,21 +1,72 @@ + + public class ConversionTool { - public static void main(String[] args){} + public static void main(String[] args) { + } + + public static float CentimetersToInches(float centimeters) { + double inches_per_cm = 0.393701; + if (centimeters < 0) { + return 0; + } else { + return (float) (centimeters * inches_per_cm); + } + } - public static float CentimetersToInches(float centimeters){} + public static float InchesToCentimeters(float inches) { + double cm_per_inch = 2.54; + if (inches < 0) { + return 0; + } else { + return (float) (inches * cm_per_inch); + } + } - public static float InchesToCentimeters(float inches){} + public static float FeetToMeters(float feet) { + double Meters_Per_Foot = 0.3048; + if (feet < 0) { + return 0; + } else { - public static float FeetToMeters(float feet){} + return (float) (feet * Meters_Per_Foot); + } + } - public static float MetersToFeet(float meters){} + public static float MetersToFeet(float meters) { + double Feet_Per_Meter = 3.28084; + if (meters < 0) { + return 0; + } else { + return (float) (meters * Feet_Per_Meter); + } + } - public static float CelsiusToFahrenheit(float celsius){} + public static float CelsiusToFahrenheit(float celsius) { + return (float) ((celsius * 9/5) + 32); + } - public static float FahrenheitToCelsius(float fahrenheit){} + public static float FahrenheitToCelsius(float fahrenheit) { + double fahren_to_cels = (- 32) * 5/9; + return (float) ((fahrenheit - 32) * 5/9); + } - public static float MphToKph(float mph){} + public static float MphToKph(float mph) { + double KPH_PER_MPH = 1 / 0.621371; + if (mph < 0) { + return 0; + } else { + return (float) (KPH_PER_MPH * mph); + } + } - public static float KphToMph(float kph){} + public static float KphToMph(float kph) { + double MPH_PER_KPH = 0.621371; + if (kph < 0) { + return 0; + } else { + return (float) (kph * MPH_PER_KPH); + } + } } diff --git a/target/classes/ConversionTool.class b/target/classes/ConversionTool.class index 7d20ebc7517733b6c814cac4fcef422936d99bfb..6ec2ce1f2a060194a6bc06e2f9a584a9a71d08fc 100644 GIT binary patch literal 1530 zcmaKs%TE(g6vofB!vHgd;_&hTC`D-jrSeiGsbD9j{j9@TdEqzx;amN1jr`J<6N8AJTLKku>!b%M4QG_XAjQ z$>HDczDj|vaXI|`+q|7WcvekUtLYjedD67Z93DKuo^?jjtbNyDAQL;ty`O+ zwOrP;HYdb;^z0@w8!Nb>&Kg$E%osT!qxKCeku(r11tUEXMrxwyWW=D$$j|q3fK3x4(S6RJ}8{d<9}NBdBn5;Vl{ zY9&&!dhx3l)E4-WNq*|WU4nX!&VyS^-Ie&#(fmdbn!s-czqO1XaQVRkzo!ykKAPVK zemnRb;CGhsdtH8Cfq$VAzvgIuH~0bYgW&g;@h`gk{sKSb@<*_Td~m8?Q&O60Y2J8o z_>K6Q(cSBQCnqn0(ikQ<7>KiVp%SVHSx>On} z)HUovOU{MQ?K|M#JA5ui!5u^2->3^njGJMj;1-v$i; literal 1471 zcmZva%}x_h6vxlBx1DJ_r8reUP(BJ`i$Z~DVgdoAP-7?%Wr7P`IIUAUwVffuz!SK0 z;lj8xMqj|hmBxjxHSslk1~(f2cVs z#nPcbtYSUW1K#~=n$^%chnj8hyKiJp%Qz8euvW3mGu=KhEK{|t z&I)w8nqdkwRD4`(YiC-yqnStL1IISZqZOB<*+D2Xbi}e^ zwNw=-)95(`5@1Q#nqydK#qcBZUW#f3bOe&Cy6&jft}6?J2Eu-fy*JtYdRuQeG=(3K#WVB2fCS269mK7SUBI50`%JC{rRh*{Of*x@jSoxZ_