012-002-003

Static Method: Unit Conversion

Medium

Problem Description

static method: Unit Conversion

In this problem, you will create a program that implements a static method toMiles(double km) in a Converter class to convert kilometers to miles and displays the result to standard output.

Learning Objective: Understand the characteristics of static methods

Create a Converter class with a static method to convert kilometers to miles.

Input

Line 1: Kilometers (decimal)

Output

[km] km = [miles] miles
  • 1km = 0.621371 miles (display with 2 decimal places)

Example

Input:

10.0

Output:

10.0 km = 6.21 miles

Ready to Try Running Code?

Log in to access the code editor and execute your solutions for this problem.

Don't have an account?

Sign Up