I have a problem with the setters and arrays in java, I can't set it right.
This are the getters and setters.
public Movimiento[] getMov() {
return mov;
}
public void setMov(Movimiento[] mov) {
this.mov = mov;
}
This are the attributes of Movimiento
(Movement)
private double monto;
private int tipo;
private String operacion;
this is Cuenta
public class Cuenta {
final static int MAXC = 5;
final static int MAXmov = 10;
private double monto = 0;
private Movimiento mov[] = new Movimiento [MAXmov];
private int ncuenta[] = new int [MAXC];
private Cliente clientes[] = new Cliente[MAXC];
public Cuenta(Cliente[] clientes) {
this.clientes = clientes;
}
public double getMonto() {
return monto;
}
public void setMonto(double monto) {
this.monto = monto;
}
public Movimiento[] getMov() {
return mov;
}
public void setMov(Movimiento[] mov) {
this.mov = mov;
}
Maybe I am doing something wrong, I tried to set it like this and it (and other ways) does not work.
I want to set an object to the position[0]
cuentas[ncuenta].setMov(new Movimiento(monto,tipo,operacion))[0];
The method setMove(Movimiento[])
int the type Cuenta
is not applicable for the arguments (Movimiento
)
I am stuck at this and I cant find a solution for it.