In: Computer Science
#include<iostream>
#include<iomanip> // FOR 2 DECIMAL POINT
using namespace std;
class Account{
   private:
       int accountNumber;
       double balance;
   public:
       // constructor with 2
attribute
       Account(int accountNumber,double
balance){
          
this->accountNumber = accountNumber;
           this->balance
= balance;
       }
       // construct with one
attribute
       Account(int accountNumber){
          
this->accountNumber = accountNumber;
           balance=
0.0;
       }
       // getter and setter
       void setAccountNumber(int
accountNumber){
          
this->accountNumber = accountNumber;
       }
       int getAccountNumber(){
           return
accountNumber;
       }
       void setBalance(double
balance){
           this->balance
= balance;
       }
       double getBalance(){
           return
balance;
       }
       // credit method
       void credit(double amount){
          
balance+=amount;
       }
       // debit method
       void debit(double amount){
           if(amount >
balance){
          
    cout<<"Amount withdrawn exceeds the
current balance!"<<endl<<endl;
           }else{
          
    balance -= amount;
           }
       }
       // print() method
       void print(){
          
cout<<fixed<<showpoint<<setprecision(2);
           cout<<"A/C
no: "<<accountNumber<<"
Balance=$"<<balance<<endl<<endl;
       }
       void mergeAccounts(Account
other){
           this->balance
+= other.balance;
       }
};
int main(){
   Account a1(8111,99.99);
   a1.print();
   a1.credit(20);
   a1.debit(10);
   a1.print();   
   Account a2(8222);
   a2.print();   
   a2.setBalance(100);
   a2.credit(20);
   a2.debit(200);
   a2.print();   
   a1.mergeAccounts(a2); // I added these statements,
please run the code to update the output accordingly.
   a1.print();
   return 0;
}
/* OUTPUT */

/* PLEASE UPVOTE */