This is my code so far:
public class BankAccountService {
public static void main(String[] args) {
System.out.println("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$");
System.out.println("! Welcome To San Andreas Bank !");
System.out.println("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$");
System.out.println("Enter one of the following numbers to select: ");
System.out.println("1.Select bank account ");
System.out.println("2.Check account balance ");
System.out.println("3.Deposit ");
System.out.println("4.Withdraw money ");
System.out.println("5.Transfer money ");
System.out.println("6.Exit ");
String bankaccountsstring = "BE68 5390 0754 7034, BE68 5320 0744 7534, BE68 5570 0723 7547";
String[] Bankaccounts = bankaccountsstring.split(",");
Scanner inputin1 = new Scanner(System.in);
int inputin = inputin1.nextInt();
if (inputin <= 0 || inputin > 6 ) {
System.out.println("Please try again, choose a number between 1 and 6");
}
else if (inputin == 1 ) {
for (int y = 0; y < Bankaccounts.length; y++ )
System.out.println("Your bank accounts: ");
System.out.println(Arrays.toString(Bankaccounts));
}
}
This is what I get in console
But I want it to be like this:
Your Bank accounts:
1. bank account ID 1
2. bank account ID 2
3. bank account ID 3
another example:
1. BE68 5390 0754 7034
2. BE68 5320 0744 7534
3. BE68 5570 0723 7547
How can I achieve this? I googled around but have not found a good solution for this.
Thank you in advance