i am writing a program to provide a menu for the user .. after he enters a number i use switch to decide which parameter should the user enter . Anyway, in one case ( case 1 ) i need to inputs from the user . but after the user enter the first input the program breaks the switch and go to do what is after the switch .
code :
the case 1 :
case 1:
System.out.println("Enter the Amount :");
currentAccount.debit(scanner.nextDouble());
System.out.println("Want anything else(yes/no)?");
String input=scanner.nextLine();
if(input.equalsIgnoreCase("no")){
isFinished=true;
currentAccount=null;
System.out.println("SignedOut successfully");
}
break;
output:
Choose an opearation:
1.withdraw.
2.deposit.
3.transaction history.
1
Enter the Amount :
100
Debit amount exceeded account balance.
Want anything else(yes/no)?
--------- Mhd Bank ---------
logined as :
--------------------------------
Choose an opearation:
1.withdraw.
2.deposit.
3.transaction history.