#include<iostream.h>
#include<conio.h>
class account
{
char c_name[20];
int acc_no;
char acc_type;
public:
float balance;
void get_balance(int a)
{
balance=a;
penalty();
}
void put_balance()
{
cout<<"\nyour current balance is: "<<balance;
}
void debit()
{
int deb;
cout<<"\nenter ammount to be withdrawl: ";
cin>>deb;
balance=balance-deb;
put_balance();
penalty();
}
void credit()
{
int cre;
cout<<"\nenter ammount to be credited: ";
cin>>cre;
balance=balance+cre;
put_balance();
}
/*void intrest()
{
int intr;
intr=balnce
balance=balance+intr;
cout<<"\ntotal intrest added:"<<intr;
put_balance();
} */
void penalty()
{
float pen=0;
float f=0.05;
if(balance<500)
{
cout<<"\nyour balance is less then 500";
pen=balance*f;
balance=balance-pen;
cout<<"\nyour penalty amount is: "<<pen;
put_balance();
}
else
cout<<"\nno penalty";
}
};
void main()
{
clrscr();
account acc;
acc.get_balance(5000);
acc.put_balance();
acc.credit();
acc.debit();
getch();
}
output
#include<conio.h>
class account
{
char c_name[20];
int acc_no;
char acc_type;
public:
float balance;
void get_balance(int a)
{
balance=a;
penalty();
}
void put_balance()
{
cout<<"\nyour current balance is: "<<balance;
}
void debit()
{
int deb;
cout<<"\nenter ammount to be withdrawl: ";
cin>>deb;
balance=balance-deb;
put_balance();
penalty();
}
void credit()
{
int cre;
cout<<"\nenter ammount to be credited: ";
cin>>cre;
balance=balance+cre;
put_balance();
}
/*void intrest()
{
int intr;
intr=balnce
balance=balance+intr;
cout<<"\ntotal intrest added:"<<intr;
put_balance();
} */
void penalty()
{
float pen=0;
float f=0.05;
if(balance<500)
{
cout<<"\nyour balance is less then 500";
pen=balance*f;
balance=balance-pen;
cout<<"\nyour penalty amount is: "<<pen;
put_balance();
}
else
cout<<"\nno penalty";
}
};
void main()
{
clrscr();
account acc;
acc.get_balance(5000);
acc.put_balance();
acc.credit();
acc.debit();
getch();
}
output
No comments:
Post a Comment