Hi,

I have wrote a program that (nearly) performs in the following way:
• When the program starts two bank accounts are created, using names and numbers written into the code;
• The user is then asked to enter an account number, followed by an amount to deposit in that account;
• The balance of the appropriate account is then updated accordingly, or if an incorrect account number was entered a message to this effect is displayed;
• The user is then asked if he or she wants to make more deposits;
• If the user answers ‘yes’, the process continues;
• If the user answers ‘no’, the both account details (account number, account name and balance) are displayed.

It compiles fine, I am just not sure how to change it so when you enter an account number (has to be 283748 or 289736) then if it is valid it shows the current balance then goes through all the options I have already wrote but with that account not the other account. There may be other points above that may not be included in the code.

Here is the code:



Code:
public class BankAccount2
{
    public static void main (String[]args)
{
    double num; 
    char choice;

    BankAccount account1 = new BankAccount ("283748", "Angelo Di Livio"); // account number and name
    BankAccount account2 = new BankAccount ("289736", "Donald Duck");
      
      account1.deposit(1000);// Angelo's current balance
      account2.deposit(2000);// Donald's current balance
   
   System.out.println("Enter Account Number");
   ????????????????????????????
      
      
      do
      {
      System.out.println("       BANK ACCOUNT");
      System.out.println("****************************\n\n");
      System.out.println("Enter The Amount You Wish To Deposit: ");   
      num = EasyIn.getDouble();
      account1.deposit(num);
      System.out.println("Your Balance Is Now: "  +  account1.getBalance());
      System.out.println ("Account Name: "  +  account1.getAccountName());
      System.out.println ("Account Number: "  +  account1.getAccountNumber());
       
      System.out.print ("Do you want make more deposits(y/n): ");
      choice = EasyIn.getChar();
      }while (choice == 'y' || choice == 'Y');
      System.out.println(" ");
      System.out.println("       FINAL STATEMENT"); // if user enters no then final statement is shown
      System.out.println("****************************\n\n");
      System.out.println("Your Overall Balance Is: "  +  account1.getBalance());
      System.out.println ("Account Name: "  +  account1.getAccountName());
      System.out.println ("Account Number: "  +  account1.getAccountNumber());

}
}
Any feedback would be very helpful.
Thanks