I need to make a bank in which account holder balances are updated after making a transaction.
The information of my clients is stored in an arraylist and I need only the balance to do it.
The information of the clients is given by no. account, name, age, address, balance, phone.
Try the command arraylist.set (index, "string"); but it does not work at all because my information is not completely a String.
public void subMenu(){
Scanner entrada = new Scanner(System.in);
System.out.printf( "Inserte su ID" );
opcion1 = entrada.nextInt();
System.out.println("\t\t Menu");
System.out.println("\t\t Elija una opcion ");
System.out.println("\t\t 1. Consultar informacion");
System.out.println("\t\t 2. Consultar saldo");
System.out.println("\t\t 3. Realizar un deposito");
System.out.println("\t\t 4. Realizar un retiro");
System.out.println("\t\t 5. Traspaso");
System.out.println("\t\t 6. Modificar datos");
System.out.println("\t\t 7. Eliminar su registro");
opcionMenu = entrada.nextInt();
AperturaDeCuenta cuenta11 = new AperturaDeCuenta();
String info = cuenta11.toString();
String str[] = info.split("\n");
// Crear pacientes
Clientes cliente1 = new Clientes(123423796, "Juan Camaney", 21, "Eje central no. 27 Coyoac•n CDMX", 10534.879, "5532678909");
Clientes cliente2 = new Clientes(206317648, "Vanessa Camaney", 18, "Miguel Quevedo no. 456 Coyoac•n CDMX", 1500.12, "5578360921");
Clientes cliente3 = new Clientes(314460847, "Miguel Camaney", 19, "La avante no.43 Iztapalapa CDMX", 22434.09, "5534812209");
Clientes cliente4 = new Clientes(422990352, "Brandon Camaney", 32, "El rosal no.12 Benito Juare CDMX", 28332.02, "5528203756");
Clientes cliente5 = new Clientes(597573100, "Diego Camaney", 26, "Potrero no. 89 Venustiano Carranza CDMX", 16576, "5527784148");
Clientes cliente6 = new Clientes(609337823, "Araceli Camaney", 47, "Florida no. 70 Viveros Coyoacán CDMX", 5486.25, "5534752309");
Clientes cliente7 = new Clientes(786685244,"Victor Camaney",30,"Campestre Churubusco no.90 Miguel Hidalgo CDMX", 6721109, "5634218860");
Clientes cliente8 = new Clientes(865979733, "Hugo Camaney",24,"Mujeres ilustres no. 36 Iztacalco CDMX",7744687.67,"5610943299");
Clientes cliente9 = new Clientes(962970253, "Páez Camaney",58,"Traineras no. 677 Xochimilco CDMX",56313086,"5546272100");
Clientes cliente10 = new Clientes(105903215, "Johan Camaney",24,"Mujeres ilustres no. 36 Iztacalco CDMX",706742680.21,"5637502184");
Clientes cliente11= new Clientes(numeroDeCuenta, nombre,edad,domicilio,monto,telefono);
List<Clientes> clientes = new ArrayList<Clientes>();
clientes.add(cliente1);
clientes.add(cliente2);
clientes.add(cliente3);
clientes.add(cliente4);
clientes.add(cliente5);
clientes.add(cliente6);
clientes.add(cliente7);
clientes.add(cliente8);
clientes.add(cliente9);
clientes.add(cliente10);
clientes.add(cliente11);
//*******METODOS DE ACCESO ********//
switch (opcionMenu){
case 1:
System.out.println("\nNumero de Cuenta: " + clientes.get(opcion1).getNumeroDeCuenta() +
"\n Nombre: " + clientes.get(opcion1).getNombre() +
"\n Edad: " + clientes.get(opcion1).getEdad() +
"\n Domicilio: " + clientes.get(opcion1).getDomicilio() +
"\n Monto: " + clientes.get(opcion1).getMonto() +
"\n Telefono: " + clientes.get(opcion1).getTelefono());
break;
case 2:
System.out.println("Ver mi saldo " + clientes.get(opcion1).getMonto() );
break;
case 3:
System.out.println("cantidad a depositar" );
deposito = entrada.nextInt();
saldoIng = clientes.get(opcion1).getMonto();
saldo = deposito + saldoIng;
System.out.println("Tu saldo era " + clientes.get(opcion1).getMonto() + ", Cantidad ingresada " + deposito + ", Tu saldo actual es " + saldo );
break;