-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSenhasRune.java
More file actions
53 lines (44 loc) · 1.59 KB
/
SenhasRune.java
File metadata and controls
53 lines (44 loc) · 1.59 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
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package rune;
import java.lang.String;
import java.util.ArrayList;
import java.util.Scanner;
import java.io.IOException;
/**
*
* @author rapha
*/
public class SenhasRune {//classe que guarda nomes, senhas e número de senhas em memória
private ArrayList<String> senhas= new ArrayList<>();
private ArrayList<String> nomes= new ArrayList<>();
private int num_senhas;
public SenhasRune(){
}
public void adicionaSenha(String nome,String senha){//função que adiciona nomes e senhas nos ArrayLists e incrementa o número de senhas
this.nomes.add(nome);
this.senhas.add(senha);
num_senhas++;
}
public void removeSenha(int pos){//remove nomes e senhas dos ArrayLists e decrementa o número de senhas
this.nomes.remove(pos);
this.senhas.remove(pos);
num_senhas--;
}
public void verNomes(){//imprime os nomes
for(int i=0;i<this.senhas.size();i++){
System.out.println(i+" "+this.nomes.get(i));
}
}
public int getNumSenhas(){//retorna o número de senhas
return this.num_senhas;
}
public String getSenhaInd(int index){//retorna a senha do índice
return this.senhas.get(index);
}
public String getNomeInd(int index){//retorna o nome do índice
return this.nomes.get(index);
}
}