Advertisement
Guest User

10. Animal Type

a guest
Jun 24th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.59 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         String animal = scanner.nextLine();
  8.  
  9.         switch (animal){
  10.             case "dog":
  11.                 System.out.println("mammal");
  12.                 break;
  13.             case "snake":
  14.             case "tortoise":
  15.             case "crocodile":
  16.                 System.out.println("reptile");
  17.                 break;
  18.                 default:
  19.                     System.out.println("unknown");
  20.                     break;
  21.         }
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement