0% found this document useful (0 votes)
20 views2 pages

Ingrese Una Longuitud en Metros (M)

The document contains code to convert between different units of length including meters, centimeters, millimeters, feet, inches, yards, light years, and angstroms. The user inputs a length in meters which is then converted to the other units and output.

Uploaded by

Lina Pantoja
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views2 pages

Ingrese Una Longuitud en Metros (M)

The document contains code to convert between different units of length including meters, centimeters, millimeters, feet, inches, yards, light years, and angstroms. The user inputs a length in meters which is then converted to the other units and output.

Uploaded by

Lina Pantoja
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

import java.util.

Scanner;

public class MedidasDeLongitud {

public static double Metro, Cm, Ml, Ft, Plg, Yd, Ly, Am;

public static void main(String []args){


try (Scanner entrada = new Scanner(System.in)) {
System.out.println(" Ingrese una longuitud en Metros
(M): ");
Metro=entrada.nextDouble();
}
Cm=ConvertirCm(Metro);
Ml=ConvertirMl(Metro);
Ft=ConvertirFt(Metro);
Plg=ConvertirPlg(Metro);
Yd=ConvertirYd(Metro);
Ly=ConvertirLy(Metro);
Am=ConvertirAm(Metro);

System.out.println(" La longuitud ingresada, equivalente a ");


System.out.println(" Centimetros: "+ Cm);
System.out.println(" Milimetros: "+ Ml);
System.out.println(" Pies: "+ Ft);
System.out.println(" Pulgadas: "+ Plg);
System.out.println(" Yardas: "+ Yd);
System.out.println(" Años luz: "+ Ly);
System.out.println(" Angstroms: "+ Am);

}
static double ConvertirCm(double a){
double x = a/0.01;
return x;
}
static double ConvertirMl(double b){
double x = b/0.001;
return x;
}
static double ConvertirFt(double c){
double x = c*2.808;
return x;
}
static double ConvertirPlg(double d){
double x = d*39.370;
return x;
}
static double ConvertirYd(double e){
double x = e*1.0936 ;
return x;
}
static double ConvertirLy(double f){
double x = f*0.00000000000000010570;
return x;
}
static double ConvertirAm(double g){
double x = g*1000000000;
return x;
}

You might also like