This commit is contained in:
roche
2019-11-07 16:01:52 +01:00
commit 386e847a27
11 changed files with 272 additions and 0 deletions

43
src/Logica/Gestion.java Normal file
View File

@@ -0,0 +1,43 @@
package Logica;
import java.util.Vector;
public class Gestion{
private Vector<Transaccion> gestiones;
private int suma;
private static int total;
public Gestion() {
this.gestiones=new Vector<Transaccion>();
this.suma=0;
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);
}
public int getSuma() {
return this.suma;
}
public int getTotal() {
return Gestion.total;
}
public Vector<Transaccion> getElementos(){
return this.gestiones;
}
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();
}
}
}