Created
January 9, 2021 04:24
-
-
Save rakibdevs/d89aace0fa92496ee6ec80ae0d14a81c to your computer and use it in GitHub Desktop.
Temperature conversions are performed by using a formula, which differs depending on the two temperature scales you are converting between. For example, to convert 50 degrees Celsius (centigrade) to Fahrenheit, we plug our numbers into the formula as shown below: F = C * 9/5 + 32 F = 50 * 9/5 + 32 F = 90 + 32 F = 122 50 degrees Celsius is equal …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class TemparatureConvert | |
{ | |
private function kelToCel($num) | |
{ | |
return round($num - 273.15, 2); | |
} | |
private function celToFar($num) | |
{ | |
return round(($num * 9/5 + 32),2); | |
} | |
private function celToKel($num) | |
{ | |
return round($num + 273.15, 2); | |
} | |
private function farToKel($num) | |
{ | |
return round((($num + 459.67) * 5/9),2); | |
} | |
private function farToCel($num) | |
{ | |
return round(($num - 32) * 5/9, 2); | |
} | |
private function farToKel($num) | |
{ | |
return round((($num + 459.67) * 5/9),2); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment