Previous Next
0 / 11
Module DEMO-33-62DEMO-OOP-33

Travel Time Calculator

DEMO-OOP-33 โ€ข Object Oriented Programming

Browser-only practice

Problem Statement

Read travel distance and speed, then print the trip duration in hours.

Input Format

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

  1. distance in km
  2. speed in km/h

Output Format

Print the exact report in this order:

  1. Distance
  2. Speed
  3. Hours

Sample Testcases

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

Sample #1
Public sample
150
60
Distance: 150
Speed: 60
Hours: 2.50
Input: distance in km = 150, speed in km/h = 60.
Key calculation(s): timeHours = 150 / (double) 60 | "Distance: " + 150 = "Distance: 150" | "Speed: " + 60 = "Speed: 60".
Output:
Distance: 150
Speed: 60
Hours: 2.50
Sample #2
Public sample
90
45
Distance: 90
Speed: 45
Hours: 2.00
Input: distance in km = 90, speed in km/h = 45.
Key calculation(s): timeHours = 90 / (double) 45 | "Distance: " + 90 = "Distance: 90" | "Speed: " + 45 = "Speed: 45".
Output:
Distance: 90
Speed: 45
Hours: 2.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