-
Notifications
You must be signed in to change notification settings - Fork 0
/
FormandoTabela.java
86 lines (64 loc) · 2.29 KB
/
FormandoTabela.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
public class FormandoTabela {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
Tabela temp = new Tabela();
//dados da tabela, em números inteiros
while (temp.opcao == 0) {
System.out.print("Digite a opção baixo: \n");
System.out.print("Digite o número de pontos do jogo (1) \n");
System.out.print("Conferir a tabela (2) \n");
System.out.print("Sair (3)\n\r");
temp.opcao = scan.nextByte();
switch (temp.opcao) {
case 1:
System.out.print("Placar do Jogo: \r");
temp.ponto = scan.nextInt();
if (temp.ponto >= 0 && temp.ponto < 1000) {
temp.pontos.add(temp.ponto);
temp.jogos.add(temp.jogo + 1);
temp.jogo += 1;
if (temp.pontoMax > temp.ponto) {
temp.pontoMax = temp.ponto;
temp.recMax.add(temp.indiceMax);
}
if (temp.pontoMin < temp.ponto) {
temp.pontoMin = temp.ponto;
temp.recMin.add(temp.indiceMin);
}
temp.indiceMax += 1;
if (temp.recMin.size() > 0) {
temp.indiceMin += 1;
}
temp.tabela.add("\n Jogo "
+ "| Placar "
+ "| Min. da Temporada "
+ "| Máx. da Temporada "
+ "| Quebra de Rec. Min. "
+ "| Quebra de Rec. Max.");
temp.tabela.add(" " + temp.jogos.get(temp.index) + " "
+ " " + temp.pontos.get(temp.index) + " "
+ " "+ temp.pontoMax + " "
+ " " + temp.pontoMin +" "
+ " " + (temp.recMax.size() - 1)+" "
+ " " + (temp.recMin.size() - 1));
temp.index += 1;
temp.opcao = 0;
break;}
case 2:
for (int i = 0; i < temp.tabela.size(); i++) {
System.out.println(temp.tabela.get(i));
}
temp.opcao = 0;
break;
case 3:
System.out.println("Finalizando o programa...");
break;
default:
System.out.println("Opcão inválida!");
temp.opcao = 0;
break;
}
}
scan.close();
}
}