-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUsuario.java
46 lines (37 loc) · 1.02 KB
/
Usuario.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
import java.util.ArrayList;
public class Usuario {
private String nome;
private String email;
private Foto[] fotos;
private int contadorFotos;
public Usuario(String nome, String email){
this.nome = nome;
this.email = email;
fotos = new Foto[100];
contadorFotos = 0;
}
public void cadastraFoto(String url, String descricao){
Foto foto = new Foto(url, descricao);
fotos[contadorFotos] = foto;
this.contadorFotos++;
}
public String listarFotos(){
String retorno = "";
for (int i = 0; i < contadorFotos; i++){
retorno += fotos[i].toString() + "\n";
}
return retorno;
}
public int getQtdFotos(){
return this.contadorFotos;
}
public void setDescricaoFoto(String novaDescricao, int posicao){
fotos[posicao - 1].setDescricao(novaDescricao);
}
public String getNome(){
return this.nome;
}
public String getEmail(){
return this.email;
}
}