Bank Class

Description:

Define a class to represent a bank account which includes following members : Data members 1)Name 2)Account number 3)Type of account 4)Balance amt Member functions a.To assign initial value b.To deposit an account c.To withdraw an account d.To display name, account number & balance Sample Input 1: Jack 435 SB 500 500 200 Output 1: NAME=Jack ACCNO=435 TYPE=SB BALANCEAMOUNT=800 Explanation: (Initial amount 500, amount deposited 1500. Now total balance: 2000. Amount withdrawn: 200, now total money=2000-200=1800) Test Case 1 Input (stdin) Jack 435 SB 500 1500 200 Expected Output NAME=Jack ACCNO=435 TYPE=SB BALANCEAMOUNT=1800 Test Case 2 Input (stdin) Harry 456 SB 1000 200 1300 Expected Output Insufficient amount NAME=Harry ACCNO=456 TYPE=SB BALANCEAMOUNT=1200

Program :

#include <iostream>

using namespace std;

int main()

{

char n[50],b[50];

  int a,am,d,w,bal;

  cin>>n>>a>>b>>am>>d>>w;

  if((am+d)<w)

  {

    cout<<"Insufficient amount\n";

    bal=am+d;

  }

  else

    bal=am+d-w;

cout<<"NAME="<<n<<"\nACCNO="<<a<<"\nTYPE="<<b<<"\nBALANCEAMOUNT="<<bal;

return 0;

}