Añadida funcionalidad checkbox
This commit is contained in:
@@ -12,21 +12,17 @@ public class Gestion{
|
||||
Gestion.total=0;
|
||||
}
|
||||
|
||||
public void aniadirGasto(String nombre, int dinero) {
|
||||
this.gestiones.add(new Transaccion(nombre, dinero));
|
||||
this.suma+=dinero;
|
||||
Gestion.total+=total;
|
||||
}
|
||||
|
||||
public void aniadirGasto(Transaccion transaccion) {
|
||||
this.gestiones.add(transaccion);
|
||||
this.suma+=transaccion.getDinero();
|
||||
Gestion.total+=transaccion.getDinero();
|
||||
}
|
||||
|
||||
public int getSuma() {
|
||||
return this.suma;
|
||||
}
|
||||
|
||||
public int getTotal() {
|
||||
public static int getTotal() {
|
||||
return Gestion.total;
|
||||
}
|
||||
|
||||
@@ -36,8 +32,15 @@ public class Gestion{
|
||||
|
||||
public void alterarVisibilidad(boolean visibilidad, int elemento) {
|
||||
if(this.gestiones.get(elemento).alterarVisivilidad(visibilidad)) {
|
||||
this.suma-=this.gestiones.get(elemento).getDinero();
|
||||
Gestion.total-=this.gestiones.get(elemento).getDinero();
|
||||
if(this.gestiones.get(elemento).getVisivilidad()) {
|
||||
this.suma+=this.gestiones.get(elemento).getDinero();
|
||||
Gestion.total+=this.gestiones.get(elemento).getDinero();
|
||||
}else {
|
||||
this.suma-=this.gestiones.get(elemento).getDinero();
|
||||
Gestion.total-=this.gestiones.get(elemento).getDinero();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user