E.balagurusamy oop 6.1 solution
by ujjal roy
#include<bits/stdc++.h>
using namespace std;
class bank
{
string name;
int ac_number;
string type_ac;
double balance;
public :
bank(string name1, int ac,string type ,double b)
{
name=name1;
ac_number=ac;
type_ac=type;
balance=b;
}
void deposit()
{
double am;
cout<<"Enter amount to deposit: ";
cin>>am;
balance+=am;
}
void withdraw()
{
cout<<name<<endl;
cout<<balance<<endl;
double am;
cout<<"Enter amount to withdraw : ";
cin>>am;
if(am<=balance)
{
balance-=am;
cout<<"Withdraw sucvcessfully!!!\n";
}
}
void display()
{
cout<<name<<"\n"<<balance<<endl;
}
};
int main()
{
bank person("Ujjal Roy",1234,"Current",50000000);
person.deposit();
person.withdraw();
person.display();
return 0;
}
0 Comments