In: Computer Science
I have created whole program in one file and if you want to separate then separate it and add header in file #include "BankAccount.h" in header section of main() file.
still you have doubt just ping me or like it.
#include <iostream>
using namespace std;
//class BankAccount it has private member name, accountNo,accountType,balance,interestRate;
class BankAccount{
  string name;
  int accountNo;
  string accountType;
  double balance;
  double interestRate;
   public :
   //constructor which initilise the account no starting from 1000 and balance to 0;
   BankAccount()
    {
        assignAcc();
        balance = 0;
        interestRate = 0.09;
    }
    //it assigns the value to 20 customers
   void assignAcc()
   {
       static int x=1000;
       accountNo=x++;
   }
   //it returns the accountNo;
     int getAccNo()
    {
        return accountNo;
    }
    //it returns the balance
    double getbalance(){
        return balance;
    }
    //it returns the 0 1 based on account has customer or not.
    int getaccount(){
        return name.empty()?0:1;
    }
    //assign customer to account.
   void setHolderAcc(string name1,int type){
       name=name1;
       if(type==1)
       accountType="check";
       else if(type==2)
       accountType="saving";
       else if(type==3)
       accountType="business";
   }
   //deposit money to account.
   void deposit(int amount){
       balance+=amount;
   }
   //withdraw money t account
    void withdraw(int amount){
       balance-=amount;
   }
   //print the details of customer.
   void print(){
       cout<<"Account Number: "<<accountNo<<" Name:"<<name<<" Account type: "<<accountType<<" Balance: "<<balance<<endl;
   }
};
//search function search the account by accountNo and return obeject of BankAccount.
BankAccount search(BankAccount bankAccount[]){
    int accountNo;
    BankAccount account;
    cout<<"Enter the account no to search:";
    cin>>accountNo;
    for(int i=0;bankAccount[i].getaccount()!=0;i++){
        if(bankAccount[i].getaccount()==accountNo)
            return bankAccount[i];
    }
    return account;
}
//submenu using switch statement and deposite and withdraw and print based on selection.
void submenu(BankAccount bankAccount){
    int choice,amount;
    cout<<"Enter 1:deposit  2:withdraw  3:print :";
    cin>>choice;
    switch(choice){
        case 1:
        cout<<"Enter the amount to deposit: ";
        cin>>amount;
        bankAccount.deposit(amount);
        cout<<"Now your balance is "<<bankAccount.getbalance()<<endl;
        break;
        case 2:
        cout<<"Enter the amount to withdraw: ";
        cin>>amount;
        if(amount<=bankAccount.getbalance()){
        bankAccount.withdraw(amount);
        cout<<"Now your balance is "<<bankAccount.getbalance()<<endl;
        }
        else 
        cout<<"you don't have enough balance"<<endl;
        break;
        case 3:bankAccount.print();
        break;
    }
    return;
}
//it procedd customer and call the submenu with BankAccount object.
void processCustomer(BankAccount bankAccount[]){
 BankAccount account=search(bankAccount);  
 submenu(account);
}
//it add customer and shows Succesfully added or not.
void addCustomer(BankAccount bankAccount[],int n){
    string name;
    int type;
    int account=bankAccount[n].getAccNo();
     cout<<"\n"<<n+1<<":Enter name: ";
     cin.ignore();
     getline(cin,name);
     cout<<"Enter account type(1=check 2=saving 3=business):";
     cin>>type;
     bankAccount[n].setHolderAcc(name,type);
     cout<<"Account ADDED Succesfully"<<endl;
     cout<<"\n"<<name<<"   account#: "<<account<<endl;
}
//main menu which has option for new customer, exits customer or total print of customer.
int menu(){
    int choice;
    cout<<"Welcome to the Bank Account"<<endl;
    cout<<"1:New Customer 2: Exist Customer 3:print Customers Data 4:exit";
    cin>>choice;
    return choice;
}
//it prints all the customers 
void printCustomersData(BankAccount bankAccount[]){
    for(int i=0;bankAccount[i].getaccount()!=0;i++){
        bankAccount[i].print();
    }
}
//main function has loop which takes n customer added into array 
//and while contuon true which shows main  menu till exit .
int main()
{
   string name;
   int n,type;
   cout<<"Enter the number of account to create: ";
   cin>>n;
   BankAccount bankAccount[20];
   for(int i=0;i<n;i++){
     int account=bankAccount[i].getAccNo();
     cout<<"\n"<<i+1<<":Enter name: ";
     cin.ignore();
     getline(cin,name);
     cout<<"Enter account type(1=check 2=saving 3=business):";
     cin>>type;
     bankAccount[i].setHolderAcc(name,type);
     cout<<"\n"<<name<<"   account#: "<<account<<endl;
   }
   bool flag=true;
   while(flag){
    int choice=menu();
    switch(choice){
        case 1:
        addCustomer(bankAccount,n);
        n++;
        break;
        case 2:processCustomer(bankAccount);
        break;
        case 3:printCustomersData(bankAccount);
        break;
        case 4:flag=false;
    }  
   }
    return 0;
}
