-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPrincipal.java
More file actions
56 lines (48 loc) · 1.23 KB
/
Principal.java
File metadata and controls
56 lines (48 loc) · 1.23 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
import java.util.Scanner;
/**
*
* Programa principal
*
* @author eliwelton.moreira
*
*/
public class Principal {
public static void main(String[] args) {
Scanner leitor = new Scanner(System.in);
Menu menu = new Menu();
ManipulaVetores manipulaVetores = new ManipulaVetores();
int opcao = 0;
int[] vetor = null;
while(true){
menu.menu();
opcao = manipulaVetores.obterValor();
switch(opcao){
case 1:
vetor = manipulaVetores.inicializarVetor();
break;
case 2:
menu.menuImpressao();
int tipo = manipulaVetores.obterValor();
manipulaVetores.imprimirVetor(vetor, tipo);
break;
case 3:
vetor = manipulaVetores.preencherVetor(vetor, 45);
break;
case 4:
System.out.println("Digite o valor a ser pesquisado:");
int elemento = leitor.nextInt();
if(manipulaVetores.consultarElemento(vetor, elemento) == -1){
System.out.println("Valor não encontrado!");
} else {
System.out.println("Valor encontrado na posição " + manipulaVetores.consultarElemento(vetor, elemento));
}
break;
case 9:
System.exit(0);
default:
System.out.println("Opção inválida");
break;
}
}
}
}