-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPessoa.java
81 lines (64 loc) · 1.86 KB
/
Pessoa.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*
* 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 gustavohoresteesantosbarros_atividadeavaliativa2;
/**
*
* @author gustavohorestee
*/
import java.util.ArrayList;
import java.util.List;
public class Pessoa {
private String nome;
private String cpf;
private String email;
private List<Telefone> telefones;
private Endereco endereco;
public Pessoa() {
this.telefones = new ArrayList<>();
}
public void setNome(String nome) {
this.nome = nome;
}
public String getNome() {
return nome;
}
public void setCpf(String cpf) {
this.cpf = cpf;
}
public String getCpf() {
return cpf;
}
public void setEmail(String email) {
this.email = email;
}
public String getEmail() {
return email;
}
public void addTelefone(Telefone telefone) {
telefones.add(telefone);
}
public List<Telefone> getTelefones() {
return telefones;
}
public void setEndereco(Endereco endereco) {
this.endereco = endereco;
}
public Endereco getEndereco() {
return endereco;
}
public void imprimir() {
System.out.println("Pessoa:");
System.out.println("Nome: " + nome);
System.out.println("CPF: " + cpf);
System.out.println("Email: " + email);
System.out.println("Endereço: " + endereco.getRua() + ", " + endereco.getCidade() + ", " + endereco.getEstado());
if (!telefones.isEmpty()) {
System.out.println("Telefones: ");
for (Telefone telefone : telefones) {
System.out.println(telefone.getTipo() + ": " + telefone.getDdd() + " " + telefone.getNumero());
}
}
}
}