Java program that convert meters to miles, feet, and inches
Posted by Samath
Last Updated: February 08, 2021

Write a Java program that prompts the user for measurement in meters and then converts it to miles, feet, and inches.


Example:

Please enter a Measurement in Meters: 50                                                                                                                                 
Miles: 0.0311               
Feet: 164.0420        
Inches: 1968.5039

import java.util.Scanner;

public class Main
{
	public static void main(String[] args) {
		    
		Scanner input = new Scanner(System.in);
		
		double meters;
		double miles;
		double feet;
		double inches;
		
		System.out.print("Please enter a Measurement in Meters: ");
		meters = input.nextDouble();
		
		input.close();
		
		miles = meters * 0.000621371192;
		feet = meters * 3.2808399;
		inches = meters * 39.3700787;
		
		System.out.printf("\nMiles: %.4f\n", miles);
		
		System.out.printf("Feet: %.4f\n", feet);
		
		System.out.printf("Inches: %.4f",inches);
	}
}