0% found this document useful (0 votes)
96 views4 pages

Group Members: Hasnain Ahmed Abbasi (2012216) Danish Ahmed (2012209) Bilal Atiq (2012237)

The document defines a BankAccount class with data members for the name of the depositor, account number, account type, and balance amount. The class contains functions for depositing and withdrawing amounts while checking the balance, and displaying the name and balance. It includes code to declare BankAccount objects, get input from the user, call the class functions to deposit, withdraw, and display account details.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
96 views4 pages

Group Members: Hasnain Ahmed Abbasi (2012216) Danish Ahmed (2012209) Bilal Atiq (2012237)

The document defines a BankAccount class with data members for the name of the depositor, account number, account type, and balance amount. The class contains functions for depositing and withdrawing amounts while checking the balance, and displaying the name and balance. It includes code to declare BankAccount objects, get input from the user, call the class functions to deposit, withdraw, and display account details.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

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

You might also like