Advertisement
paykova

AnimalType

Oct 6th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 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. String type = " ";
  9.  
  10. switch (animal) {
  11. case "dog":
  12. type = "mammal";
  13. break;
  14. case "crocodile":
  15. case "tortoise":
  16. case "snake":
  17. type = "reptile";
  18. break;
  19. default:
  20. type = "unknown";
  21. break;
  22. } System.out.println(type);
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement