#include<iostream>
#include<math.h>
using namespace std;
class account
{
char name[20];
long ac_no;
protected:
int bal;
public:
char type[20];
void getdetails()
{
cout<<"Name of customer";
cin>>name;
cout<<"Account Number";
cin>>ac_no;
cout<<"Balance";
cin>>bal;
}
void putdetails()
{
cout<<"Name: "<<name<<"\nAccount No: "<<ac_no<<"\nBalance: "<<bal;
}
void deposit()
{
int x;
cout<<"Enter Amount To Deposit ";
cin>>x;
bal=bal+x;
}
void withdrawl(){
int x;
cout<<"Enter Amount To Withdraw ";
cin>>x;
if(bal>=x)
{
bal=bal-x;
}
else
{
cout<<"\nBalance is Not Sufficient";
}
}
};
class savings:public account
{
int interest;
public:
void interestt(float r=0.075,int t=1)
{
bal=bal*pow((1+r),t);
}
};
class current:public account
{
public:
void min()
{
if(bal<1000)
{
bal=bal-100;
}
}
void cheque()
{
int x;
cout<<"Enter The Money To Be Debited ";
cin>>x;
bal=bal-x;
}
};
main()
{ savings s;
current c;
int ch;
cout<<"Enter account type";
cout<<"\nPress 1 for Saving";
cout<<"\nPress 2 for Current\n";
cin>>ch;
if(ch==1)
{s.getdetails();}
else
{c.getdetails();}
cout<<"\n\n\nWHAT DO U WANT TO DO\n\n\n";
cout<<"************************************************************";
int c1=1;
while(c1!=7)
{
cout<<"\n1. TO WITHDRAWL ";
cout<<"\n2. TO DEPOSIT ";
cout<<"\n3. TO DISPLAY ";
cout<<"\n4. Cheque Withdrawl ";
cout<<"\n5. Interest ";
cout<<"\n6. Minimum Balance ";
cout<<"\n7. To Exit\n ";
cin>>c1;
switch(c1)
{
case 1:
if(ch==1)
s.withdrawl();
else
c.withdrawl();
break;
case 2:
if(ch==1)
s.deposit();
else
c.deposit();
break;
case 3:
if(ch==1)
s.putdetails();
else
c.putdetails();
break;
case 4:
if(ch==1)
cout<<"NO Chequebook Facility";
else
c.cheque();
break;
case 5:
if(ch==1)
s.interestt();
else
cout<<"Curret Accounts Get No Compound Interest";
break;
case 6:
if(ch==1)
cout<<"No Penality";
else
c.min();
break;
case 7:
break;
}
}
cout<<"\n\n\nTHANKS FOR USING OUR SERVICE";
}
#include<math.h>
using namespace std;
class account
{
char name[20];
long ac_no;
protected:
int bal;
public:
char type[20];
void getdetails()
{
cout<<"Name of customer";
cin>>name;
cout<<"Account Number";
cin>>ac_no;
cout<<"Balance";
cin>>bal;
}
void putdetails()
{
cout<<"Name: "<<name<<"\nAccount No: "<<ac_no<<"\nBalance: "<<bal;
}
void deposit()
{
int x;
cout<<"Enter Amount To Deposit ";
cin>>x;
bal=bal+x;
}
void withdrawl(){
int x;
cout<<"Enter Amount To Withdraw ";
cin>>x;
if(bal>=x)
{
bal=bal-x;
}
else
{
cout<<"\nBalance is Not Sufficient";
}
}
};
class savings:public account
{
int interest;
public:
void interestt(float r=0.075,int t=1)
{
bal=bal*pow((1+r),t);
}
};
class current:public account
{
public:
void min()
{
if(bal<1000)
{
bal=bal-100;
}
}
void cheque()
{
int x;
cout<<"Enter The Money To Be Debited ";
cin>>x;
bal=bal-x;
}
};
main()
{ savings s;
current c;
int ch;
cout<<"Enter account type";
cout<<"\nPress 1 for Saving";
cout<<"\nPress 2 for Current\n";
cin>>ch;
if(ch==1)
{s.getdetails();}
else
{c.getdetails();}
cout<<"\n\n\nWHAT DO U WANT TO DO\n\n\n";
cout<<"************************************************************";
int c1=1;
while(c1!=7)
{
cout<<"\n1. TO WITHDRAWL ";
cout<<"\n2. TO DEPOSIT ";
cout<<"\n3. TO DISPLAY ";
cout<<"\n4. Cheque Withdrawl ";
cout<<"\n5. Interest ";
cout<<"\n6. Minimum Balance ";
cout<<"\n7. To Exit\n ";
cin>>c1;
switch(c1)
{
case 1:
if(ch==1)
s.withdrawl();
else
c.withdrawl();
break;
case 2:
if(ch==1)
s.deposit();
else
c.deposit();
break;
case 3:
if(ch==1)
s.putdetails();
else
c.putdetails();
break;
case 4:
if(ch==1)
cout<<"NO Chequebook Facility";
else
c.cheque();
break;
case 5:
if(ch==1)
s.interestt();
else
cout<<"Curret Accounts Get No Compound Interest";
break;
case 6:
if(ch==1)
cout<<"No Penality";
else
c.min();
break;
case 7:
break;
}
}
cout<<"\n\n\nTHANKS FOR USING OUR SERVICE";
}