-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPrincipalEtapa3.java
More file actions
45 lines (40 loc) · 1.76 KB
/
PrincipalEtapa3.java
File metadata and controls
45 lines (40 loc) · 1.76 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
package Etapa3;
/**
* Classe principal que executa os testes da Etapa 3.
*/
public class PrincipalEtapa3 {
public static void main(String[] args) {
System.out.println("===========================================================================\n" +
" RELATÓRIO DE EXECUÇÃO\n" +
"===========================================================================\n");
// Teste 1: Contagem de elementos em uma lista estática
System.out.println("Teste 1: Contagem de Elementos em uma Lista Estática");
StaticList<Integer> lista = new StaticList<>(10);
lista.insert(1, 0);
lista.insert(2, 1);
lista.insert(3, 2);
lista.insert(1, 3);
lista.insert(2, 4);
int contagem = lista.contaElementos(1);
System.out.println("O elemento 1 aparece " + contagem + " vezes na lista.");
System.out.println("---------------------------------------------------\n");
// Teste 2: Verificação de parênteses agrupados
System.out.println("Teste 2: Verificação de Parênteses Agrupados");
StaticStack<Character> pilha = new StaticStack<>(16);
pilha.push('(');
pilha.push('A');
pilha.push('+');
pilha.push('B');
pilha.push(')');
pilha.push('-');
pilha.push('(');
pilha.push('C');
pilha.push('+');
pilha.push('D');
pilha.push(')');
Etapa3 etapa3 = new Etapa3();
boolean ok = etapa3.checkBrackets(pilha);
System.out.println("A expressão tem parênteses agrupados corretamente? " + ok);
System.out.println("---------------------------------------------------");
}
}