-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPaciente1.java
56 lines (45 loc) · 986 Bytes
/
Paciente1.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
package Diabetes1;
public class Paciente1 {
private String nome;
private double exames[];
private int tamanho;
private double media;
private int cont;
public Paciente1(String nome, int n){
this.nome=nome;
tamanho=n;
exames = new double[tamanho];
}
public String getNome(){
return nome;
}
public double getAnalise(int i){
return exames[i];
}
public double getMedia(){
for(int i=0;i<tamanho;i++){
media = media+exames[i];
}
media = media/tamanho;
return media;
}
public int getDiagnostico(){
for(int i=0;i<tamanho;i++){
media = media+exames[i];
}
media = media/tamanho;
if(media<140){
return 0;
}
if(media>=140 && media<=199){
return 1;
}
else{
return 2;
}
}
public void insere(double x){
exames[cont]=x;
cont++;
}
}