init
This commit is contained in:
43
src/Logica/Gestion.java
Normal file
43
src/Logica/Gestion.java
Normal 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user