-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjanela.java
More file actions
52 lines (43 loc) · 1.74 KB
/
janela.java
File metadata and controls
52 lines (43 loc) · 1.74 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
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Scanner;
public class janela {
public static void main(String[] args) throws IOException {
int op, tam, qtd;
String resp = "";
Scanner scanner = new Scanner(System.in);
FileWriter escritor = new FileWriter("senha.txt", true);
while (true) {
System.out.println("|_________________|");
System.out.println("| 1 - Numeros |");
System.out.println("| 2 - Letras |");
System.out.println("|_________________|");
System.out.println("Informe a opcao: ");
op = scanner.nextInt();
if (op == 1 || op == 2){
System.out.println("Informe o tamanho: ");
tam = scanner.nextInt();
System.out.println("Informe a quantidade de senha: ");
qtd = scanner.nextInt();
try {
Senha senha = new Senha(op, tam);
resp = senha.geradorSenha(tam, op, qtd);
try{
senha.salvaSenha(resp, escritor);
} catch (IOException e) {
// throw new RuntimeException(e);
System.out.println("Erro ao escrever no arquivo");
}
}
catch (RuntimeException e){
System.out.println(e.getMessage());
}
System.out.println(resp);
}else{
System.out.println("Opcao Invalida!!");
return;
}
}
}
}