-
Notifications
You must be signed in to change notification settings - Fork 0
/
Animal.java
50 lines (44 loc) · 1.49 KB
/
Animal.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package edu.danilo.dio.desafiosdecodigo;
import java.io.IOException;
import java.util.Scanner;
public class Animal {
public static void main(String[] args) throws IOException {
Scanner scanner = new Scanner(System.in);
String AN1, AN2, AN3, resultado = null;
AN1 = scanner.nextLine();
AN2 = scanner.nextLine();
AN3 = scanner.nextLine();
//TODO: Implemente as condição necessária para que seja verificado que tipo de animal é:
//Dica: Você pode utilizar o método equals para realizar comparações.
if (AN1.equals("vertebrado")) {
if (AN2.equals("ave")) {
if (AN3.equals("carnivoro")) {
resultado = "aguia";
} else {
resultado = "pomba";
}
} else {
if (AN3.equals("onivoro")) {
resultado = "homem";
} else {
resultado = "vaca";
}
}
} else {
if (AN2.equals("inseto")) {
if (AN3.equals("hematofago")) {
resultado = "pulga";
} else {
resultado = "lagarta";
}
} else {
if (AN3.equals("hematofago")) {
resultado = "sanguessuga";
} else {
resultado = "minhoca";
}
}
}
System.out.println(resultado);
}
}