Skip to content

conversion tools microlab #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions conversion.iml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,7 @@
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
</component>
</module>
69 changes: 60 additions & 9 deletions src/main/java/ConversionTool.java
Original file line number Diff line number Diff line change
@@ -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);
}
}
}
Binary file modified target/classes/ConversionTool.class
Binary file not shown.