Class Solution
java.lang.Object
g2401_2500.s2469_convert_the_temperature.Solution
2469 - Convert the Temperature.<p>Easy</p>
<p>You are given a non-negative floating point number rounded to two decimal places <code>celsius</code>, that denotes the <strong>temperature in Celsius</strong>.</p>
<p>You should convert Celsius into <strong>Kelvin</strong> and <strong>Fahrenheit</strong> and return it as an array <code>ans = [kelvin, fahrenheit]</code>.</p>
<p>Return <em>the array <code>ans</code>.</em> Answers within <code>10<sup>-5</sup></code> of the actual answer will be accepted.</p>
<p><strong>Note that:</strong></p>
<ul>
<li><code>Kelvin = Celsius + 273.15</code></li>
<li><code>Fahrenheit = Celsius * 1.80 + 32.00</code></li>
</ul>
<p><strong>Example 1:</strong></p>
<p><strong>Input:</strong> celsius = 36.50</p>
<p><strong>Output:</strong> [309.65000,97.70000]</p>
<p><strong>Explanation:</strong> Temperature at 36.50 Celsius converted in Kelvin is 309.65 and converted in Fahrenheit is 97.70.</p>
<p><strong>Example 2:</strong></p>
<p><strong>Input:</strong> celsius = 122.11</p>
<p><strong>Output:</strong> [395.26000,251.79800]</p>
<p><strong>Explanation:</strong> Temperature at 122.11 Celsius converted in Kelvin is 395.26 and converted in Fahrenheit is 251.798.</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>0 <= celsius <= 1000</code></li>
</ul>
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Solution
public Solution()
-
-
Method Details
-
convertTemperature
public double[] convertTemperature(double celsius)
-