Computer Science, asked by sudarsankrishna19, 8 months ago

define a class named 'Bank Account' to represent following member....data member=Account number, name of depositor, Account type, balance account ..... member function= initialise member, deposit amount, withdraw amount, display balance...... write a c++ program to test the bank account class for 10 customer​

Answers

Answered by Anonymous
13

There are three pages

I HOPE it will help you

PLEASE MARK ME AS BRILLIANT and ALSO GIVE ME THANKS

Attachments:
Answered by shritik1605sl
0

Answer:

#include<iostream.h>

#include<conio.h>

#include<stdio.h>

#include<process.h>

class Bank

{

//Declarating the data members

public:

char name[20];

char account_type[20];

int account_number;

int balance;

//member functions of the class Bank

// initialize function to initialize data members

void initialize()

{

cout<<"\nEnter Account Holders Name:";

gets(name);

cout<<"\nEnter Account type:";

gets(account_type);

cout<<"\nEnter account number:";

cin>>account_number;

cout<<"\Enter balance to deposit:";

cin>>balance;

}

//deposit() function to deposit amount in account

void deposit()

{

int bal;

cout<<"\nEnter the amout to deposit:";

cin>>bal;

balance+=bal;

cout<<"\nAmount deposited successfuly\nYour New Balance:"<<balance;

}

//check() function to withdraw amount and check remaining balance

void check()

{

int bal;

cout<<"\nYour balance :"<<balance<<"\nEnter amount to withdraw:";

cin>>bal;

if(bal<=balance)

{

balance-=bal;

cout<<"\nRemaining Balance:"<<balance;

}

else

{

exit(0);

}

}

//display function to display user information

void display()

{

cout<<"\nName :";

puts(name);

cout<<"\nBalance :"<<balance;

}

};

void main()

{

int i;

clrscr();

//An array of objects of Bank class can be created to handle 10 customers and their data

//as Bank bk[10];

//Then run this array in loop to initialize and access it's data members

Bank bk;

bk.initialize();

cout<<"\n1. Your Information\n2. Deposit\n3. Withdraw\nEnter your choice\n";

cin>>i;

if(i==1)

{

bk.display();

}

else if(i==2)

{

bk.deposit();

}

else if(i==3)

{

bk.check();

}

getch();

}

The explanation of the code is already mentioned in comments please go through it.

#SPJ3

Similar questions