1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- public class ConversionTool {
- public float numToConvert;
-
- public static void main(String[] args){}
-
- public static float CentimetersToInches(float centimeters){
- float inches = centimeters * (float) 0.393701;
- if (inches <= 0) {
- return 0;
- } else {
- return inches;
- }
- }
-
- public static float InchesToCentimeters(float inches){
- float centimeters = inches * (float) 2.54;
- if (centimeters <= 0) {
- return 0;
- } else {
- return centimeters;
- }
- }
-
- public static float FeetToMeters(float feet){
- float meters = feet * (float) 0.3048;
- if (meters <= 0) {
- return 0;
- } else {
- return meters;
- }
- }
-
- public static float MetersToFeet(float meters){
- float feet = meters * (float) 3.28084;
- if (feet <= 0) {
- return 0;
- } else {
- return feet;
- }
- }
-
- public static float CelsiusToFahrenheit(float celsius){
- float fahrenheit = (celsius * (float) 1.8) + 32;
- return fahrenheit;
- }
-
- public static float FahrenheitToCelsius(float fahrenheit){
- float celsius = (fahrenheit - 32) * (float) .5556;
- return celsius;
- }
-
- public static float MphToKph(float mph){
- float kph = mph * (float) 1.60934;
- if (kph <= 0) {
- return 0;
- } else {
- return kph;
- }
- }
-
- public static float KphToMph(float kph){
- float mph = kph * (float) 0.621369647819285;
- if (mph <= 0) {
- return 0;
- } else {
- return mph;
- }
- }
-
- }
|