-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLista.java
More file actions
35 lines (30 loc) · 837 Bytes
/
Copy pathLista.java
File metadata and controls
35 lines (30 loc) · 837 Bytes
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
public class Lista {
Aluno[] alunos;
int tamanho;
int capacidade;
Lista (int c) {
tamanho = 0;
capacidade = c;
alunos = new Aluno[capacidade];
}
void imprimir(){
for (int i=0; i < tamanho; i++){
System.out.println("Nome: "+alunos[i].nome);
System.out.println("RA: "+alunos[i].RA);
System.out.println("NP1: "+alunos[i].NP1);
System.out.println("NP2: "+alunos[i].NP2);
System.out.println();
}
}
boolean cheia(){
return tamanho == capacidade;
}
void adicionar(Aluno aluno){
if(cheia()){
System.out.println("Lista cheia !");
} else {
alunos[tamanho] = aluno;
tamanho++;
}
}
}