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

Distance Unit Converter

DEMO-OOP-33 โ€ข Object Oriented Programming

Browser-only practice

Problem Statement

Read a distance in meters and print both kilometers and centimeters.

Input Format

Input is given as whitespace-separated tokens in this order:

  1. distance in meters

Output Format

Print the exact report in this order:

  1. Kilometers
  2. Centimeters

Sample Testcases

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

Sample #1
Public sample
1250.0
Kilometers: 1.250
Centimeters: 125000.00
Input: distance in meters = 1250.0.
Key calculation(s): kilometers = 1250.0 / 1000.0 | centimeters = 1250.0 * 100.0 | "Kilometers: " + String.format("%.3f", kilometers) = "Kilometers: 1.250".
Output:
Kilometers: 1.250
Centimeters: 125000.00
Sample #2
Public sample
2.5
Kilometers: 0.003
Centimeters: 250.00
Input: distance in meters = 2.5.
Key calculation(s): kilometers = 2.5 / 1000.0 | centimeters = 2.5 * 100.0 | "Kilometers: " + String.format("%.3f", kilometers) = "Kilometers: 0.003".
Output:
Kilometers: 0.003
Centimeters: 250.00

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