123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
-
- public class ConversionTool {
-
-
- public static void main(String[] args) {}
-
- public static float CentimetersToInches(float centimeters) {
-
- float inches = centimeters * 0.393701f;
- if (centimeters <= 0) {
- return 0;
- }
- else {
- return inches;
- }
- }
-
- public static float InchesToCentimeters(float inches) {
- float centimeters = 2.54f * inches;
-
- if (inches <= 0) {
- return 0;
-
- }
- else {
- return centimeters;
- }
- }
-
- public static float FeetToMeters(float feet) {
- float meters = InchesToCentimeters(feet * 12) / 100f;
-
- if (feet <= 0) {
- return 0;
- }
- else {
- return meters;
- }
- }
-
- public static float MetersToFeet(float meters) {
- float feet = CentimetersToInches(meters * 100) / 12f;
-
- if (meters <= 0) {
- return 0;
- }
- else {
- return feet;
- }
- }
-
- public static float FahrenheitToCelsius(float fahrenheit) {
- float celsius = (fahrenheit - 32) / 1.8f;
-
- return celsius;
- }
-
- public static float CelsiusToFahrenheit(float celsius) {
- float fahrenheit = (celsius * 1.8f) + 32;
- return fahrenheit;
- }
-
- public static float MphToKph(float mph) {
-
- if (mph <= 0) {
- return 0;
- }
- else {
- return mph * 1.60934f;
- }
- }
-
- public static float KphToMph(float kph) {
-
- if (kph <= 0) {
- return 0;
- }
- else {
- return kph * 0.621371f;
- }
- }
- }
-
|