# Temperature Converter

Easy
16
1
81.3% Acceptance

Your goal is to implement a Java method, `convertTemperature`, capable of converting temperatures between Celsius, Kelvin, and Fahrenheit. The method should take into account various edge cases and extreme values associated with these temperature scales.

### Method Signature

``````public class Main {
public static double convertTemperature(double inputValue, String currentUnit, String requiredUnit) {
}
}``````

### Input

• `inputValue`: A floating-point number representing the temperature value.
• `currentUnit`: A string indicating the current temperature unit ("c" for Celsius, "k" for Kelvin, "f" for Fahrenheit).
• `requiredUnit`: A string indicating the desired temperature unit.

### Output

The method should return the converted temperature value rounded to two decimal places.

1. Celsius to Kelvin:

• Formula: Kelvin = Celsius + 273.15
• Example: To convert 25°C to Kelvin, calculate 25 + 273.15 = 298.15 K.
2. Celsius to Fahrenheit:

• Formula: Fahrenheit = (Celsius * 9/5) + 32
• Example: To convert 25°C to Fahrenheit, calculate (25 * 9/5) + 32 = 77 °F.
3. Kelvin to Celsius:

• Formula: Celsius = Kelvin - 273.15
• Example: To convert 300 K to Celsius, calculate 300 - 273.15 = 26.85 °C.
4. Kelvin to Fahrenheit:

• Formula: Fahrenheit = (Kelvin - 273.15) * 9/5 + 32
• Example: To convert 300 K to Fahrenheit, calculate (300 - 273.15) * 9/5 + 32 = 80.33 °F.
5. Fahrenheit to Kelvin:

• Formula: Kelvin = (Fahrenheit - 32) * 5/9 + 273.15
• Example: To convert 77°F to Kelvin, calculate (77 - 32) * 5/9 + 273.15 = 298.15 K.
6. Fahrenheit to Celsius:

• Formula: Celsius = (Fahrenheit - 32) * 5/9
• Example: To convert 77°F to Celsius, calculate (77 - 32) * 5/9 = 25 °C.

Each formula in the method is designed to convert temperatures between these three units. The method also rounds the final result to two decimal places for precision and readability.

You can use this method to round the result to two decimal places

``Math.round(result * 100.0) / 100.0``

### Instructions

1. Implement the `convertTemperature` method in the provided `Main` class.
2. Ensure accurate conversions between Celsius, Kelvin, and Fahrenheit.
3. Account for edge cases and extreme values associated with temperature scales.
4. Round the returned output to two decimal places.

### Challenges

#### Challenge 1: Celsius to Kelvin Conversion

Implement the `convertTemperature` method to accurately convert from Celsius to Kelvin.

##### Test Case:
• Input: `convertTemperature(25.0, "c", "k")`

• Expected Output: Approximately 298.15 (rounded to two decimal places)

#### Challenge 2: Celsius to Fahrenheit Conversion

Ensure that the `convertTemperature` method correctly converts from Celsius to Fahrenheit.

##### Test Case:
• Input: `convertTemperature(30.5, "c", "f")`

• Expected Output: Approximately 86.90 (rounded to two decimal places)

#### Challenge 3: Kelvin to Celsius Conversion

Implement the `convertTemperature` method to handle conversions from Kelvin to Celsius accurately.

##### Test Case:
• Input: `convertTemperature(300.0, "k", "c")`

• Expected Output: Approximately 26.85 (rounded to two decimal places)

#### Challenge 4: Kelvin to Fahrenheit Conversion

Verify that the `convertTemperature` method correctly converts from Kelvin to Fahrenheit.

##### Test Case:
• Input: `convertTemperature(500.0, "k", "f")`

• Expected Output: Approximately 440.33 (rounded to two decimal places)

#### Challenge 5: Fahrenheit to Kelvin Conversion

Ensure that the `convertTemperature` method accurately converts from Fahrenheit to Kelvin.

##### Test Case:
• Input: `convertTemperature(98.6, "f", "k")`

• Expected Output: Approximately 310.15 (rounded to two decimal places)

#### Challenge 6: Fahrenheit to Celsius Conversion

Implement the `convertTemperature` method to handle conversions from Fahrenheit to Celsius correctly.

##### Test Case:
• Input: `convertTemperature(212.0, "f", "c")`

• Expected Output: 100.0 (rounded to two decimal places)