- Four attribute name(only first name),address(city name),account number,amount
- Open_Account() method asks to name and address.
- account_number_Genration() this method used to generate automatic account numbers according to application number.
- deposit() this method deposit money
- withdrawal() this method withdrawal money
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
#include<string> | |
using namespace std; | |
class Bank | |
{ | |
private: | |
char name[100]; | |
char address[100]; | |
int account_number=2009; | |
long double amount=1000; | |
public: | |
void Open_Account() //account opening function | |
{ | |
cout<<"Enter your first name :"; | |
cin>>name; | |
cout<<"Enter your city name : "; | |
cin>>address; | |
cout<<"Opening balance is "<<amount<<endl; | |
} | |
void account_number_Genration()//AUTOMATIC account number | |
{ | |
cout<<"Your Automatic account number is "<<account_number+1<<endl; | |
account_number=account_number+1; | |
} | |
void deposit() //deposit function | |
{ | |
long double deposit_amount; | |
cout<<"Your deposit amount :"<<endl; | |
cin>>deposit_amount; | |
amount=amount+deposit_amount; | |
cout<<"Your Balance is now :"<<amount<<endl; | |
} | |
void withdrawal() // withdrawal | |
{ | |
double withD; | |
cout<<"Your account number is "<<account_number<<endl; | |
cout<<"How much you want to withdrawal :"<<endl;; | |
cin>>withD; | |
if(withD<=amount) | |
{ | |
cout<<"You enter "<<withD<<endl; | |
cout<<"Please collect your money"<<endl; | |
amount=amount-withD; | |
cout<<"Your Balance is remain :"<<amount<<endl; | |
} | |
else | |
{ | |
cout<<"Insufficent amount "<<endl; | |
cout<<"Your account balance is :"<<amount<<endl; | |
} | |
} | |
}; | |
int main() | |
{ | |
Bank shivam,choubey; | |
shivam.Open_Account(); | |
shivam.account_number_Genration(); | |
shivam.deposit(); | |
shivam.withdrawal(); | |
choubey.Open_Account(); | |
choubey.account_number_Genration(); | |
choubey.deposit(); | |
choubey.withdrawal(); | |
return 0; | |
} |
Enter your first name :shivam Enter your city name : jabalpur Opening balance is 1000 Your Automatic account number is 2010 Your deposit amount : 2000 Your Balance is now :3000 Your account number is 2010 How much you want to withdrawal : 1500 You enter 1500 Please collect your money Your Balance is remain :1500 Enter your first name :choubey Enter your city name : delhi Opening balance is 1000 Your Automatic account number is 2010 Your deposit amount : 10000 Your Balance is now :11000 Your account number is 2010 How much you want to withdrawal : 56489 Insufficent amount Your account balance is :11000
0 Comments
If you have any doubt and suggestion Please let me know