I have problem with do while loop
I need something like this
What do you want to do?
1 Create a new account
2 Deposite funds
3 Withdraw funds
4 Show Balance
5 Show Interest
6 Show Summary
7 Quit
Enter Option: 2
Which account <1 to 2> do you wish to use? 2000
ERROR Please Enter an account number between 1 and 2
Which account <1 to 2> do you wish to use? 2
How much money would you like to deposit?
but it just stops at the error message?
public static void input2() // option 2
{
// input Scanner
Scanner in = new Scanner(System.in);
int input1 = 0;
boolean check2 = false;
do {
if (account.size() == 1) {
System.out.print("\nHow much money would you like to deposit? ");
input1 = in.nextInt();
account.get(0).deposit(input1);
check2 = true;
}
else if (account.size() > 1) {
System.out.print("\nWhich account <1 to " + account.size() + "> do you wish to use? ");
input1 = in.nextInt();
boolean check3 = true;
do {
if (input1 <= account.size())
{
System.out.print("\nHow much money would you like to deposit? ");
int take = 0;
take = in.nextInt();
account.get(input1 - 1).deposit(take);
}
else
{
System.out.print("\nERROR Please Enter an account number between 1 and " + account.size());
System.out.println();
check3 = false;
} } while(!true);
}
} while (!true);
} // end option2