Saturday, 11 January 2014

Small Project Of Banking System in C++

Assume that a bank maintains two kinds of accounts for its customers, one called as savings account and other as current account. The savings account provides compound interest and withdrawal facilities but no checkbook facility. The current account provides checkbook facility but no interest. Current account holders should maintain a minimum balance  and if the balance falls below this level as service charge is imposed.
Create a Class account that stress customer name, account number and type of account. From this derive Classes cur_account and sav_account to make them more specific to their requirements include necessary member functions in order to achieve the following tasks:
1) Accept deposits from a customer and update the balance.
2) Display the balance.
3) Compute and deposit the interest.
4) Permit withdrawal and update the balance.
5)Check for the minimum balance and impose penalty necessary and update the balance.

#include<iostream.h>
#include<conio.h>
#include<math.h>
#include<string.h>
class Account
{private:char c_name[25];
             int acc_no;
             char type[7];
 public:void read(int);
            void display();
};
class Sav_acc:public Account
{private:float balance;
             float debit;
             float deposit;
             float interest;
 public:void update();
};
class Cur_acc:public Account
{private:float balance;
             int pages_ch;
             float debit;
             float deposit;
 public:void update_cur();
};
void Account::read(int x)
{int i=0,j=0;
 char sav[7]="savings",cur[7]="current";
 clrscr();
 cout<<"\nEnter your account number:";
 cin>>acc_no;
 cout<<"\nEnter your name:";
 cin>>c_name;
 if(x==1)
 {for(i=0;i<7;i++)
  {type[i]=sav[i];
  }
 }
 else
 {for(j=0;j<7;j++)
  {type[j]=cur[j];
  }
 }
}
void Sav_acc::update()
{int amt;
 cout<<"\n enter the balance:";
 cin>>balance;
 cout<<"\n Enter the amount of money to be withdrawn:";
 cin>>debit;
 cout<<"\n The balance after the withdrawal is:";
 balance=balance-debit;
 cout<<balance;
 cout<<"\n Enter the amount to be deposited:";
 cin>>deposit;
 cout<<"\n The amount after deposit is:";
 balance=balance+deposit;
 cout<<balance;
 cout<<"\n The compound interest for the two years is  3.5% \n";
 amt=(1+(3.5/100));
 interest=pow(amt,2);
 cout<<"\n The balance after the compound interest is:";
 balance=balance+interest;
 cout<<balance;
}
void Cur_acc::update_cur()
{int c=0;
 char ch;
 balance=0;
 cout<<"\n Enter the amount to be deposited:";
 cin>>deposit;
 cout<<"\n The amount after deposit is:";
 balance=balance+deposit;
 cout<<balance;
 cout<<"\n Enter the amount of money to be withdrawn:";
 cin>>debit;
 cout<<"\n The balance after the withdrawal is:";
 balance=balance-debit;
 cout<<balance;
 if(balance<1000)
 {cout<<"\n The balance in the account is less than the limit";
  balance=balance-100;
  cout<<"\n The balance after the penalty is:"<<balance;
 }
 while(c==0)
 {cout<<"\n do you want to issue the cheque book (y-yes,n-no): " ;
  cin>>ch;
  if(ch=='y')
  {cout<<"\n Enter the number of pages to be issued of the cheque book:";
   cin>>pages_ch;
   cout<<"\n the book will be issued to you after two days:";
   c=1;
  }
  else
  {if(ch=='n')
   {c=1;}
   else
   {cout<<"\n sorry you have entered wrong choice:";
    getch();
   }
  }
 }
}
void Account::display()
{cout<<"\nThe account number is:"<<acc_no;
 cout<<"\nThe name of the customer is:"<<c_name;
 cout<<"\nThe type of account is:"<<type;
 getch();
}
void main()
{int i=0,c=0;
 clrscr();
 while(i==0)
 {clrscr();
  cout<<"\n enter the choice of operation to be performed \n  1:savings \n  2:current \n  3:exit \n  enter choice:";
  cin>>c;
  switch(c)
  {case 1:Sav_acc a;
              a.read(c);
              a.update();
              a.display();
              getch();
              break;
   case 2:Cur_acc b;
              b.read(c);
              b.update_cur();
              b.display();
              getch();
              break;
   case 3:i=1;
              cout<<"\n thanks for using our services:";
              getch();
              break;
   default:cout<<"\n sorry you have entered wrong choice enter again:";
               getch();
  }
 }

}

No comments:

Post a Comment