-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExer20.java
More file actions
61 lines (43 loc) · 1.2 KB
/
Exer20.java
File metadata and controls
61 lines (43 loc) · 1.2 KB
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
51
52
53
54
55
56
57
58
59
60
package com.laiane.cursojava.aula15;
import java.util.Scanner;
public class Exer20 {
public static void main(String[] args) {
try (Scanner scan = new Scanner(System.in )) {
System.out.println("Telefonou para a vítima?");
String resp1 = scan.next();
System.out.println("Esteve no local do crime?");
String resp2 = scan.next();
System.out.println("Mora perto da vítima?");
String resp3 = scan.next();
System.out.println("Já trabalhou com a vítima?");
String resp4 = scan.next();
System.out.println("Devia para a vítima?");
String resp5 = scan.next();
int cont = 0;
if (resp1.equalsIgnoreCase("S")){
cont++;
}
if (resp2.equalsIgnoreCase("S")){
cont++;
}
if (resp3.equalsIgnoreCase("S")){
cont++;
}
if (resp4.equalsIgnoreCase("S")){
cont++;
}
if (resp5.equalsIgnoreCase("S")){
cont++;
}
if (cont == 2) {
System.out.println("Suspeita");
} else if (cont == 3 || cont == 4) {
System.out.println("Cúmplice");
} else if (cont == 5) {
System.out.println("Assassino");
} else if (cont == 0) {
System.out.println("Inocente");
}
}
}
}