martinvalchev

Animal Type

Oct 31st, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.50 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class AnimalType {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         String animal = scanner.nextLine();
  8.  
  9.         if (animal.equals("dog")) {
  10.             System.out.println("mammal");
  11.         } else if (animal.equals("crocodile") || animal.equals("tortoise") || animal.equals("snake")) {
  12.             System.out.println("reptile");
  13.         } else {
  14.             System.out.println("unknown");
  15.         }
  16.     }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment