This class is used to perform conversions between US (Imperial) and metric measurement systems. This class has functions that allow for the use of different data types, depending on what your need is. The genesis of this is the work currently underway on a prototype of the next version of the OSHA Heat Safety app.
Integer Conversions
fahrenheitToCelsius(tempInF:)
Converts an integer temperature from Fahrenheit to celsius
fahrenheitToCelsius(tempInF: Int)
Parameters
Name |
Optional / Required |
Data Type |
Description |
tempInF |
Required |
Integer |
Temperature, in degrees Fahrenheit |
Return Value(s)
Data Type |
Description |
Integer |
Temperature, in degrees Celsius |
celsiusToFahrenheit(tempInC:)
Converts an integer temperature from Celsius to Fahrenheit
celsiusToFahrenheit(tempInC: Int)
Parameters
Name |
Optional / Required |
Data Type |
Description |
tempInF |
Required |
Integer |
Temperature, in degrees Celsius |
Return Value(s)
Data Type |
Description |
Integer |
Temperature, in degrees Fahrenheit |
milesToKilometers(speedInMPH:)
Converts miles to kilometers
milesToKilometers(speedInMPH: Int)
Parameters
Name |
Optional / Required |
Data Type |
Description |
speedInMPH |
Required |
Integer |
Distance, in miles |
Return Value(s)
Data Type |
Description |
Integer |
Distance, in kilometers |
kilometersToMiles(speedInKPH:)
Converts miles to kilometers
kilometersToMiles(speedInKPH: Int)
Parameters
Name |
Optional / Required |
Data Type |
Description |
speedInKPH |
Required |
Integer |
Distance, in kilometers |
Return Value(s)
Data Type |
Description |
Integer |
Distance, in miles |
Double Conversions
fahrenheitToCelsius(tempInF:)
Converts an double temperature from Fahrenheit to celsius
fahrenheitToCelsius(tempInF: Double)
Parameters
Name |
Optional / Required |
Data Type |
Description |
tempInF |
Required |
Double |
Temperature, in degrees Fahrenheit |
Return Value(s)
Data Type |
Description |
Double |
Temperature, in degrees Celsius |
celsiusToFahrenheit(tempInC:)
Converts an double temperature from Celsius to Fahrenheit
celsiusToFahrenheit(tempInC: Double)
Parameters
Name |
Optional / Required |
Data Type |
Description |
tempInF |
Required |
Double |
Temperature, in degrees Celsius |
Return Value(s)
Data Type |
Description |
Double |
Temperature, in degrees Fahrenheit |
milesToKilometers(speedInMPH:)
Converts miles to kilometers
milesToKilometers(speedInMPH: Double)
Parameters
Name |
Optional / Required |
Data Type |
Description |
speedInMPH |
Required |
Double |
Distance, in miles |
Return Value(s)
Data Type |
Description |
Double |
Distance, in kilometers |
kilometersToMiles(speedInKPH:)
Converts miles to kilometers
kilometersToMiles(speedInKPH: Double)
Parameters
Name |
Optional / Required |
Data Type |
Description |
speedInKPH |
Required |
Double |
Distance, in kilometers |
Return Value(s)
Data Type |
Description |
Double |
Distance, in miles |
inchesToCentimeters(depthInInches:)
Converts inches to centimeters
inchesToCentimeters(depthInInches: Double)
Parameters
Name |
Optional / Required |
Data Type |
Description |
depthInInches |
Required |
Double |
Length/depth, in inches |
Return Value(s)
Data Type |
Description |
Double |
Length/depth, in centimeters |
centimetersToInches(depthInCentimeters:)
Converts centimeters to inches
centimetersToInches(depthInCentimeters: Double)
Parameters
Name |
Optional / Required |
Data Type |
Description |
depthInCentimeters |
Required |
Double |
Length/depth, in centimeters |
Return Value(s)
Data Type |
Description |
Double |
Length/depth, in inches |