-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathConversionTool.java
More file actions
57 lines (45 loc) · 1.14 KB
/
ConversionTool.java
File metadata and controls
57 lines (45 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
public class ConversionTool {
public static void main(String[] args){}
public static float CentimetersToInches(float centimeters){
if(centimeters <0){
return 0;
}
return centimeters/2.54f;
}
public static float InchesToCentimeters(float inches){
if(inches <0){
return 0;
}
return inches*2.54f;
}
public static float FeetToMeters(float feet){
if(feet < 0){
return 0;
}
return feet* 0.3048f;
}
public static float MetersToFeet(float meters){
if(meters < 0){
return 0;
}
return meters/0.3048f;
}
public static float CelsiusToFahrenheit(float celsius){
return (celsius*1.8f)+32;
}
public static float FahrenheitToCelsius(float fahrenheit){
return (fahrenheit-32)*.5556f;
}
public static float MphToKph(float mph){
if(mph < 0){
return 0;
}
return mph*1.609344f;
}
public static float KphToMph(float kph){
if(kph < 0){
return 0;
}
return kph/1.609344f;
}
}