import java.util.Scanner;
public class UnitConverter {
public static void main(String[] args) {
int choice = 0;
double num = 0.0;
Scanner in = new Scanner(System.in);
System.out.print("In what unit is your current number in? (1=meters;2=feet;3=miles)\n");
try {
choice = in.nextInt();
System.out.println(choice);
} catch (Exception e) {
System.out.println("not an int");
}
in.close();
in = new Scanner(System.in);
System.out.print("whats the number you want to convert\n");
try {
num = in.nextDouble();
System.out.println(num);
} catch (Exception e) {
System.out.println("not a double");
}
in.close();
if (choice==1) {
double feet = num*3.28084;
double miles = num*0.000621371;
System.out.println(num + " in feet is " + feet + " ft\n" + num + " in miles is " + miles + " mi");
}
else if (choice==2) {
double meter = num*0.3048;
double miles = num/5280;
System.out.println(num + " in meters is " + meter + " m\n" + num + " in miles is " + miles + " mi");
}
else if (choice==3) {
double meter = num*1609.34;
double feet = num*5280;
System.out.println(num + " in meters is " + meter + " m\n" + num + " in feet is " + feet + " ft");
}
}
}
UnitConverter.main(null);