DevJourney · code I wrote while learning

README.md

Single File Programming Question

Problem Statement

Sam is writing a program that takes the speed (in km/h) and the time (in hours) as input and calculates the distance travelled. Your task is to guide him in creating a class called Distance with speed and time as public attributes. Using a friend function calcDistance(), the program should calculate the total distance travelled.

Input format :

The input consists of two space-separated integers, representing the speed(in km/h) and time(in hours).

Output format :

The output prints a single double value, representing the calculated distance, rounded off to two decimal places.

Refer to the sample output for formatting specifications.

Code constraints :

The given test cases fall under the following constraints:

1 ≤ speed, time ≤ 500

Sample test cases :

Input 1 :

40 120

Output 1 :

4800.00

Input 2 :

10 356

Output 2 :

3560.00