-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProyecto.java
95 lines (79 loc) · 2.6 KB
/
Proyecto.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
package tema5;
public class Proyecto {
private String nombreProyecto;
private int codigo;
private String nombreDirector;
private Investigador vInvestigadores[];
private int cantInvestigadores;
private int dimL = 0;
public Proyecto(String nombre, int codigo, String nom_Director){
this.nombreProyecto = nombre;
this.codigo = codigo;
nombreDirector = nom_Director;
cantInvestigadores = 50;
vInvestigadores = new Investigador[cantInvestigadores];
inicializarVector();
}
public String getNombreProyecto() {
return nombreProyecto;
}
public void setNombreProyecto(String nombre) {
this.nombreProyecto = nombre;
}
public int getCodigo() {
return codigo;
}
public void setCodigo(int codigo) {
this.codigo = codigo;
}
public String getNombreDirector() {
return nombreDirector;
}
public void setNombreDirector(String nombreCompleto) {
this.nombreDirector = nombreCompleto;
}
public void inicializarVector(){
for (int i = 0; i < cantInvestigadores; i++){
vInvestigadores[i] = null;
}
}
public void agregarInvestigador(Investigador invest){
if (vInvestigadores == null)
vInvestigadores = new Investigador[cantInvestigadores];
if (dimL < cantInvestigadores){
vInvestigadores[dimL] = invest;
dimL++;
}
}
public double dineroTotalOtorgado(){
double montoTotal = 0;
int investigadores = (dimL);
for (int i = 0; i < investigadores; i++)
montoTotal += vInvestigadores[i].montoTotalSubsidios();
return montoTotal;
}
public void otorgarTodos(String nom_completo_Invest){
int i = 0;
boolean encontre = false;
int investigadores = (dimL+1);
while ((i < investigadores) && (!encontre)){
if (vInvestigadores[i].getNombreCompleto().equals(nom_completo_Invest)){
encontre = true;
vInvestigadores[i].otorgarTodosLosSubsidios();
}
i++;
}
}
public String mostrarInvestigadores(){
String str = "";
for (int i = 0; i < dimL; i++){
str += vInvestigadores[i].toString()+"\n";
}
return str;
}
@Override
public String toString(){
String str = "Nombre del proyecto: "+getNombreProyecto()+", codigo: "+getCodigo()+", nombre del director: "+getNombreDirector()+", total de dinero otorgado: $"+dineroTotalOtorgado()+"\n"+mostrarInvestigadores();
return str;
}
}