for example if i input 2 it would go straight to option 2 and then if i press 1 it would go to option 1. from there i want to be able to go to any other option without the program stopping. help would be greatly appreciated
Scanner sc = new Scanner(System.in);
Account chequingAcc = new ChequingAccount();
System.out.println("Please enter your Unique Number");
chequingAcc.setuniqueString(sc.nextLine(…
System.out.println("verefied, what would you like to do?");
System.out.println("to check balance press 1");
System.out.println("to debit account press 2");
System.out.println("to credit account press 3");
System.out.println("to overdraft account press 4");
System.out.println("to exit press 5");
int k = sc.nextInt();
if(k<=0 ||k>5){
System.out.println("invalid ");
k =sc.nextInt();
}
while( k==1){
System.out.println("--------------------…
System.out.println("Chequing Account current balance is $" + chequingAcc.getbalance());
System.out.println("what you like do now?");
System.out.println("to debit account press 2");
System.out.println("to credit account press 3");
System.out.println("to overdraft account press 4");
System.out.println("to exit press 5");
k =sc.nextInt();
while (k==2){
System.out.println("--------------------…
System.out.println("enter ammount to debit to Chequing Account");
chequingAcc.setDebit(sc.nextDouble());
System.out.println("Chequing Account current balance is $" + chequingAcc.getbalance());
System.out.println("what you like do now?");
System.out.println("to check balance press 1");;
System.out.println("to credit account press 3");
System.out.println("to overdraft account press 4");
System.out.println("to exit press 5");
k =sc.nextInt();
while(k==3){
System.out.println("--------------------…
System.out.println("enter the ammount to credit to Chequing Account");
chequingAcc.setCredit(sc.nextDouble());
System.out.println("Chequing Account current balance is $" + chequingAcc.getbalance());
System.out.println("what you like do now?");
System.out.println("to check balance press 1");;
System.out.println("to debit account press 2");
System.out.println("to overdraft account press 4");
System.out.println("to exit press 5");
k =sc.nextInt();
while(k==4){
System.out.println("--------------------…
System.out.println("enter the ammount to overDraft to Chequing Account");
chequingAcc.setoverDraft(sc.nextDouble()…
System.out.println("Chequing Account current balance is $" + chequingAcc.getbalance());
System.out.println("what you like do now?");
System.out.println("to check balance press 1");;
System.out.println("to debit account press 2");
System.out.println("to credit account press 3");
System.out.println("to exit press 5");
k =sc.nextInt();
while(k==5){
System.out.println("thank for using the bank");
System.exit(0);
}
}
}
}
}
}
}