Advertisement
Guest User

Judge Invalid

a guest
Apr 1st, 2021
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.60 KB | None | 0 0
  1.     public static void main(String[] args) {
  2.  
  3.         Scanner scan = new Scanner(System.in);
  4.  
  5.         double digit = Double.parseDouble(scan.nextLine());
  6.         String input = scan.nextLine();
  7.         String output = scan.nextLine();
  8.  
  9.         switch (input) {
  10.             case "mm" -> digit = digit / 1000;
  11.             case "cm" -> digit = digit / 100;
  12.         }
  13.         digit = switch (output) {
  14.             case "mm" -> digit * 1000;
  15.             case "cm" -> digit * 100;
  16.             case "m" -> digit * 1;
  17.             default -> digit;
  18.         };
  19.         System.out.printf("%.3f", digit);
  20.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement