-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEleicao.java
More file actions
62 lines (42 loc) · 1.8 KB
/
Eleicao.java
File metadata and controls
62 lines (42 loc) · 1.8 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
61
62
import java.util.Scanner;
public class Eleicao {
public static void main(String[] args) {
Scanner entrada = new Scanner(System.in);
int opcao = 0;
int totalVoto;
int bn = 0;
Integer candi1 = 0;
int candi2 = 0;
while (opcao != -1) {
System.out.println(" Escolha um opcão abaixo de voto : ");
System.out.println(" ");
System.out.println(" -1 Encerrar Eleição ");
System.out.println(" 0 Brancos e Nulos ");
System.out.println(" 1 Candidato 1 ");
System.out.println(" 2 Canditado 2 ");
opcao = entrada.nextInt();
if (opcao == 0) {
System.out.println(" Voce votou Branco e Nulo");
bn = bn + 1;
}
if (opcao == 1) {
System.out.println(" Você votou no candidato : 1");
candi1 = candi1 + 1;
}
if (opcao == 2) {
System.out.println(" Você votou no candidato : 2 ");
candi2 = candi2 + 1;
}
if (opcao == -1) {
System.out.println(" Você encerrou o programa.");
System.out.println(" ");
System.out.println(" CONTAGEM DOS VOTOS: ");
totalVoto = bn + candi1 + candi2;
System.out.println(" O numero de brancos e Nulos foi de " + bn + " voto(s)");
System.out.println(" O Candidato 1 recebeu " + candi1 + " voto(s) ");
System.out.println(" O candidato 2 recebeu " + candi2 + " voto(s)");
System.out.println(" Total de Votos :" + totalVoto + " voto(s)");
}
}
}
}