010-003-002
Method Overloading: Temperature Conversion
Easy
Problem Description
Method Overloading: Temperature Conversion
Learning Objective: Implement different processing by parameter type using overloading
Define convertToFahrenheit method with same name but different parameter types (int, double, String) to convert Celsius to Fahrenheit. Implement calculation processing for each type.
Input
None (use fixed values)
Output
[celsius]C = [fahrenheit]F
```java
Conversion formula: Fahrenheit = Celsius × 9/5 + 32
## Examples
### Example 1: Basic values
Output:
```java
0C = 32F
25.5C = 77.9F
30C = 86.0F
```java
### Example 2: Different values
Output:
```java
100C = 212F
37.5C = 99.5F
15C = 59.0F
Test Cases
※ Output examples follow programming industry standards
Input:
Expected Output:
0C = 32F 25.5C = 77.9F 30C = 86.0F
Input:
Expected Output:
0C = 32F 25.5C = 77.9F 30C = 86.0F
Input:
Expected Output:
0C = 32F 25.5C = 77.9F 30C = 86.0F
❌ Some tests failed
Your Solution
Current Mode:● My Code
99
1
2
3
4
5
6
7
8
9
10
›
⌄
⌄
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
// Write your code here
sc.close();
}
}
0 B / 5 MB
You have 9 free executions remaining
