Previous Next
0 / 15
Module DEMO-33-69DEMO-OOP-33

Temperature Record

DEMO-OOP-33 โ€ข Object Oriented Programming

Browser-only practice

Problem Statement

Create two Java files: Main.java and TemperatureRecord.java.

Read the required values, construct a TemperatureRecord object, and print a multiline report.

The report must contain these lines in this order:

  1. City
  2. Fahrenheit

Use a constructor and keep the object-oriented structure clear.

Input Format

Input is provided as separate whitespace-separated tokens in the same order described in the problem statement.

Output Format

Print the exact multiline report required by the question.

Sample Testcases

Submit runs every public testcase in this browser. Results and code never leave this device.

Sample #1
Public sample
Amman
25.0
City: Amman
Fahrenheit: 77.00
Input: city = "Amman", temperature in celsius = 25.0.
Key calculation(s): "City: " + "Amman" = "City: Amman" | "Fahrenheit: " + String.format("%.2f", (25.0 * 9.0 / 5.0) + 32.0) = "Fahrenheit: 77.00".
Output:
City: Amman
Fahrenheit: 77.00
Sample #2
Public sample
Irbid
18.5
City: Irbid
Fahrenheit: 65.30
Input: city = "Irbid", temperature in celsius = 18.5.
Key calculation(s): "City: " + "Irbid" = "City: Irbid" | "Fahrenheit: " + String.format("%.2f", (18.5 * 9.0 / 5.0) + 32.0) = "Fahrenheit: 65.30".
Output:
City: Irbid
Fahrenheit: 65.30

Web terminal

C, C++, Java, and Python run locally in a browser VM. No worker or visualizer is used.

Saved in this browser
Editor settings