013-004-001
Field Scope: Thermometer Class
Easy
Problem Description
Field Scope: Thermometer class
In this problem, you will create a program that defines a Thermometer class with a field to store the Celsius temperature, then uses multiple methods that access that field to calculate and display both Celsius and Fahrenheit temperatures.
Learning Objective: Understand field scope and access from methods
Create a Thermometer class and confirm that all methods in the class can access the fields.
Input
Line 1: Celsius temperature (integer)
Output
Celsius: [celsius]C
Fahrenheit: [fahrenheit]F
```java
*Fahrenheit = Celsius * 9 / 5 + 32.
Test Cases
※ Output examples follow programming industry standards
Input:
25
Expected Output:
Celsius: 25C Fahrenheit: 77F
Input:
0
Expected Output:
Celsius: 0C Fahrenheit: 32F
Input:
100
Expected Output:
Celsius: 100C Fahrenheit: 212F
Input:
25
Expected Output:
Celsius: 25C Fahrenheit: 77F
❌ Some tests failed
Your Solution
Current Mode:● My Code
Thermometer.java🔒
Solution.java🔒
2/6 ファイル100B
⚠️警告
- No main method found
9
1
2
3
4
›
⌄
import java.util.Scanner;
class Thermometer {
}
0 B / 5 MB
You have 7 free executions remaining
