divider

Objective

Create a console application that converts a distance from miles to kilometers based on user input.

Skills to Practice

  • icon Prompting a user for input
  • icon Saving user input to variables
  • icon Converting input to the correct data type (if necessary)
  • icon Performing arithmetic calculations
  • icon Formatting custom output using variables
divider

Tasks

  • icon Create a new project named mitokm-lastname.
  • icon Complete the following tasks:
    • icon Prompt the user to enter a distance in miles.
    • icon Convert the miles value from the user to the equivalent value in Kilometers.
    • icon Formula: Km = Mi × 1.609
    • icon Optionally, round the answer to two decimal places.
    • icon Display the calculated Kilometers value to the user in a clear and formatted manner.

Sample Output

Sample Output
--- Miles to Kilometers Calculator ---
Enter the distance in miles: 12.5 [Enter]
12.5 miles is equal to 20.11 kilometers

Begin Challenge