Inicio soporte graficos, añadido soporte para diferenciar gastos e
ingresos
This commit is contained in:
@@ -3,8 +3,8 @@ import java.util.Vector;
|
||||
|
||||
public class Gestion{
|
||||
private Vector<Transaccion> gestiones;
|
||||
private int suma;
|
||||
private static int total;
|
||||
private float suma;
|
||||
private static float total;
|
||||
|
||||
public Gestion() {
|
||||
this.gestiones=new Vector<Transaccion>();
|
||||
@@ -15,14 +15,18 @@ public class Gestion{
|
||||
public void aniadirGasto(Transaccion transaccion) {
|
||||
this.gestiones.add(transaccion);
|
||||
this.suma+=transaccion.getDinero();
|
||||
Gestion.total+=transaccion.getDinero();
|
||||
if(transaccion.isPositivo()) {
|
||||
Gestion.total+=transaccion.getDinero();
|
||||
}else {
|
||||
Gestion.total-=transaccion.getDinero();
|
||||
}
|
||||
}
|
||||
|
||||
public int getSuma() {
|
||||
public float getSuma() {
|
||||
return this.suma;
|
||||
}
|
||||
|
||||
public static int getTotal() {
|
||||
public static float getTotal() {
|
||||
return Gestion.total;
|
||||
}
|
||||
|
||||
@@ -33,10 +37,18 @@ public class Gestion{
|
||||
public void alterarVisibilidad(int elemento) {
|
||||
if(this.gestiones.get(elemento).alterarVisivilidad()) {
|
||||
this.suma+=this.gestiones.get(elemento).getDinero();
|
||||
Gestion.total+=this.gestiones.get(elemento).getDinero();
|
||||
if(this.gestiones.get(elemento).isPositivo()) {
|
||||
Gestion.total+=this.gestiones.get(elemento).getDinero();
|
||||
}else {
|
||||
Gestion.total-=this.gestiones.get(elemento).getDinero();
|
||||
}
|
||||
}else {
|
||||
this.suma-=this.gestiones.get(elemento).getDinero();
|
||||
Gestion.total-=this.gestiones.get(elemento).getDinero();
|
||||
if(this.gestiones.get(elemento).isPositivo()) {
|
||||
Gestion.total-=this.gestiones.get(elemento).getDinero();
|
||||
}else {
|
||||
Gestion.total+=this.gestiones.get(elemento).getDinero();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user