Group Members
Hasnain Ahmed Abbasi (2012216)
Danish Ahmed(2012209)
Bilal Atiq (2012237)
Define a class for a bank account that includes the following data members:
Name of the depositor
Account Number
Type of account
Balance amount in the account
The class also contains the following member functions:
A constructor to assign initial values
Deposit function to deposit some amount. It should accept the amount as parameter.
Withdraw function to withdraw an amount after checking the balance. It should accept the amount
as parameter.
Display function to display name and balance.
#include<iostream>
using namespace std;
class bank
string nameOfdepositor;
int accountNumber;
string typeOfaccount;
float balanceAmount;
public:
bank()
nameOfdepositor=typeOfaccount;
accountNumber=0;
balanceAmount=0;
void data();
void Deposit(int amount);
void Withdraw(int amount);
void display();
clsr();
};
void bank::data(){
cout<<"Enter depositor name:";
cin>>nameOfdepositor;
cout<<"Enter account number:";
cin>>accountNumber;
cout<<"Enter Balance:";
cin>>balanceAmount;
cin.ignore();
cout<<"Enter type of account e.g current account other:";
cin>>typeOfaccount;
void bank::Deposit(int amount){
balanceAmount+=amount;
void bank::Withdraw(int amount){
if(balanceAmount<amount){
cout<<"Balance not sufficient plz input correct amount";
else
{
balanceAmount-=amount;
void bank::display()
cout<<"\n\tDetails of customer....>"<<endl;
cout<<"Name of depositor:"<<nameOfdepositor;
cout<<"\ncurrent balance:"<<balanceAmount<<endl;
int main()
int a;
int c;
bank b;
b.data();
cout<<"Enter deposit amount:";
cin>>a;
b.Deposit(a);
cout<<"Enter amount of Cash to Withdraw:";
cin>>c;
b.Withdraw(c);
b.display();
return 0;
Output Screenshot