-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAluno.java
More file actions
265 lines (210 loc) · 5.85 KB
/
Aluno.java
File metadata and controls
265 lines (210 loc) · 5.85 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
package cursojava.classes;
import java.util.ArrayList;
import java.util.List;
//Classe que representa o Aluno.
public class Aluno {
private String nome;
private int idade;
private String dataNascimento;
private String registroGeral;
private String numeroCpf;
private String nomeMae;
private String nomePai;
private String dataMatricula;
private String nomeEscola;
private String serieMatriculado;
private List<Disciplina> disciplinas = new ArrayList<Disciplina>();
private List<Bimestre> bimestres = new ArrayList<Bimestre>();
public void setDisciplinas(List<Disciplina> disciplinas) {
this.disciplinas = disciplinas;
}
public List<Disciplina> getDisciplinas() {
return disciplinas;
}
public Aluno() {
// TODO Auto-generated constructor stub
}
public Aluno(String nomeDefault, int idadeDefault) {
// TODO Auto-generated constructor stub
nome = nomeDefault;
idade = idadeDefault;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public int getIdade() {
return idade;
}
public void setIdade(int idade) {
this.idade = idade;
}
public String getDataNascimento() {
return dataNascimento;
}
public void setDataNascimento(String dataNascimento) {
this.dataNascimento = dataNascimento;
}
public String getRegistroGeral() {
return registroGeral;
}
public void setRegistroGeral(String registroGeral) {
this.registroGeral = registroGeral;
}
public String getNumeroCpf() {
return numeroCpf;
}
public void setNumeroCpf(String numeroCpf) {
this.numeroCpf = numeroCpf;
}
public String getNomeMae() {
return nomeMae;
}
public void setNomeMae(String nomeMae) {
this.nomeMae = nomeMae;
}
public String getNomePai() {
return nomePai;
}
public void setNomePai(String nomePai) {
this.nomePai = nomePai;
}
public String getDataMatricula() {
return dataMatricula;
}
public void setDataMatricula(String dataMatricula) {
this.dataMatricula = dataMatricula;
}
public String getNomeEscola() {
return nomeEscola;
}
public void setNomeEscola(String nomeEscola) {
this.nomeEscola = nomeEscola;
}
public String getSerieMatriculado() {
return serieMatriculado;
}
public void setSerieMatriculado(String serieMatriculado) {
this.serieMatriculado = serieMatriculado;
}
public double getMedia() {
double somaNota = 0.0;
for (Disciplina disciplina : disciplinas) {
somaNota += disciplina.getNota();
}
return somaNota / disciplinas.size();
}
public boolean getResultado() {
double media = this.getMedia();
if (media >= 7.0) {
return true;
} else {
return false;
}
}
@Override
public String toString() {
return "Aluno [nome=" + nome + ", idade=" + idade + ", dataNascimento="
+ dataNascimento + ", registroGeral=" + registroGeral
+ ", numeroCpf=" + numeroCpf + ", nomeMae=" + nomeMae
+ ", nomePai=" + nomePai + ", dataMatricula=" + dataMatricula
+ ", nomeEscola=" + nomeEscola + ", serieMatriculado="
+ serieMatriculado + ", disciplinas=" + disciplinas + "]";
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((dataMatricula == null) ? 0 : dataMatricula.hashCode());
result = prime * result
+ ((dataNascimento == null) ? 0 : dataNascimento.hashCode());
result = prime * result
+ ((disciplinas == null) ? 0 : disciplinas.hashCode());
result = prime * result + idade;
result = prime * result + ((nome == null) ? 0 : nome.hashCode());
result = prime * result
+ ((nomeEscola == null) ? 0 : nomeEscola.hashCode());
result = prime * result + ((nomeMae == null) ? 0 : nomeMae.hashCode());
result = prime * result + ((nomePai == null) ? 0 : nomePai.hashCode());
result = prime * result
+ ((numeroCpf == null) ? 0 : numeroCpf.hashCode());
result = prime * result
+ ((registroGeral == null) ? 0 : registroGeral.hashCode());
result = prime
* result
+ ((serieMatriculado == null) ? 0 : serieMatriculado.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Aluno other = (Aluno) obj;
if (dataMatricula == null) {
if (other.dataMatricula != null)
return false;
} else if (!dataMatricula.equals(other.dataMatricula))
return false;
if (dataNascimento == null) {
if (other.dataNascimento != null)
return false;
} else if (!dataNascimento.equals(other.dataNascimento))
return false;
if (disciplinas == null) {
if (other.disciplinas != null)
return false;
} else if (!disciplinas.equals(other.disciplinas))
return false;
if (idade != other.idade)
return false;
if (nome == null) {
if (other.nome != null)
return false;
} else if (!nome.equals(other.nome))
return false;
if (nomeEscola == null) {
if (other.nomeEscola != null)
return false;
} else if (!nomeEscola.equals(other.nomeEscola))
return false;
if (nomeMae == null) {
if (other.nomeMae != null)
return false;
} else if (!nomeMae.equals(other.nomeMae))
return false;
if (nomePai == null) {
if (other.nomePai != null)
return false;
} else if (!nomePai.equals(other.nomePai))
return false;
if (numeroCpf == null) {
if (other.numeroCpf != null)
return false;
} else if (!numeroCpf.equals(other.numeroCpf))
return false;
if (registroGeral == null) {
if (other.registroGeral != null)
return false;
} else if (!registroGeral.equals(other.registroGeral))
return false;
if (serieMatriculado == null) {
if (other.serieMatriculado != null)
return false;
} else if (!serieMatriculado.equals(other.serieMatriculado))
return false;
return true;
}
public List<Bimestre> getBimestres() {
return bimestres;
}
public void setBimestres(List<Bimestre> bimestres) {
this.bimestres = bimestres;
}
}