Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- double digit = Double.parseDouble(scan.nextLine());
- String input = scan.nextLine();
- String output = scan.nextLine();
- switch (input) {
- case "mm":
- digit = digit / 1000;
- break;
- case "cm":
- digit = digit / 100;
- break;
- }
- switch (output) {
- case "mm":
- digit = digit * 1000;
- break;
- case "cm":
- digit = digit * 100;
- break;
- case "m":
- digit = digit * 1;
- break;
- }
- System.out.printf("%.3f", digit);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement