Is it possible to switch between the created 'Account' objects? I have a class before this one that gets all the required information, and the code that you see here is in the main method. * There are variables in the main method before this while-loop, but I'm not having trouble with that part of my code.
``` while(answer == 1) { System.out.print("Select from your created accounts: ");//the user can select from their creat accounts using by pressing the account number //the account number variable is in 'Account' class and it increments by one each time the account object is called for(int i = 0; i < accounts; i++)//prints the name of the created user accounts and selection number { System.out.print(users[i].name + "(" + users[i].selection + ")" + " "); } pick = input.nextInt(); for(int i = 0; i < accounts; i++) { while(pick == users[i].selection)//displays these options if the pick variable == the selection variable { System.out.println("A. Display account information"); System.out.println("B. Check account balance"); System.out.println("C. Make a deposit"); System.out.println("D. Make a withdrawal"); System.out.println("E. Change adress"); System.out.println("F. Exit"); answer = input.next().charAt(0); answer = Character.toUpperCase(answer); switch(answer)//lets user select an option { case 'A': users[i].displayInfo(); break; case 'B': users[i].checkBalance(); break; case 'C': users[i].deposit(); break; case 'D': users[i].withdraw(); break; case 'E': users[i].changeAdress(); break; case 'F': System.out.println(); break; default: System.out.println("Please enter one of the options listed."); break; } //when the user presses 'F' or 'f', I want the compiler to go back to print 'select from your accounts' and then let the user select an account to manipulate its information //it works the first time through, but after that, it's stuck in a loop where it just displays all the options for the account } } ```
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)