Código Java:
  Ver original
case 1:
// Añadir nueva cuenta
Cuenta newCuenta = new Cuenta();
dato = teclado.nextLine();
newCuenta.setNombre(dato);
dato = teclado.nextLine();
newCuenta.setApellidos(dato);
dato = teclado.nextLine();
newCuenta.setFechaNacim(dato);
numero = teclado.nextInt();
newCuenta.setSaldoInic(numero);
numero = teclado.nextInt();
newCuenta.setCcc(numero);
numero = teclado.nextInt();
newCuenta.setInteres(numero);
// Añadimos el objeto "cuenta" al ArrayList
listadoCuentas.add(newCuenta);
teclado.nextLine();
break;
Código Java:
  Ver original
case 2:
// Imprimimos los elementos del ArrayList
Iterator<Cuenta> itrCuentas = listadoCuentas.iterator();
while(itrCuentas.hasNext()){
Cuenta cuenta = itrCuentas.next();
+ cuenta.getNombre() + " "
+ cuenta.getApellidos() + " / "
+ cuenta.getSaldo() + "€");
}
teclado.nextLine();
break;
Código Java:
El case3 s el que me da problemas probe de diferentes formas pero no hay manera de que apartir del numero de cuenta me muestre los datos bancarios de dicha cuenta.Ver original
case 3:
// Imprimimos los elementos del elemento buscado
numero = teclado.nextInt();
itrCuentas = listadoCuentas.iterator();
while(itrCuentas.hasNext()){
Cuenta cuenta = itrCuentas.next();
if(listadoCuentas.contains(numero))
+ cuenta.getNombre() + " "
+ cuenta.getApellidos() + " / "
+ cuenta.getSaldo() + "€");
}
break;
Gracias de antemano
 
 
 busqueda en ArrayList de objetos
 busqueda en ArrayList de objetos 


