Bank Account Saving Deposit Withdrawal coderinme

Bank Account Saving Deposit Withdrawal coderinme

Bank Account Saving Deposit Withdrawal coderinmeCreate a class to represent a bank account. Include the following:
Data members:
Account number
Name of account holder
Type of account
Balance amount
Member functions:
To initialize the data members with appropriate data
To deposit an amount
To withdraw an amount after checking the balance
To display details of account holder
Write a C++ program to use this class.

#include<iostream.h>
#include<conio.h>
#define MAX 50
class Bank
{
int acc_no;
char name[MAX];
char type[MAX];
double bal;
public:
void getdetail()
{
cout<<endl<<"\nenter the account number: ";
cin>>acc_no;
fflush(stdin);
cout<<"enter the name of person: ";
cin.getline(name,30);
cout<<"enter the type of account: ";
cin.getline(type,30);
cout<<"enter the balance: ";
cin>>bal;
}
void deposit(double depo)
{
bal=bal+depo;
cout<<"Balance after deposit: "<<bal<<endl;
}
void withdrawl(double with)
{
bal=bal-with;
cout<<"Balance after withdrawl: "<<bal<<endl;
}
void show()
{
cout<<endl;
cout<<"account number: "<<acc_no<<endl;
cout<<"name of person: "<<name<<endl;
cout<<"type of account: "<<type<<endl;
cout<<"Remaining balance: "<<bal<<endl;
cout<<endl;
}
};
int main()
{
double depo,with;
Bank b1;
b1.getdetail();
b1.show();
cout<<"\nenter the amount of deposit: ";
cin>>depo;
b1.deposit(depo);
cout<<"\nenter the amount for withdrawl: ";
cin>>with;
b1.withdrawl(with);
getch();
return 0;
}

For more programs in C++, visit our C++ Coder Archives

Bank Account Saving Deposit Withdrawal coderinme

All rights reserved. No part of this Post may be copied, distributed, or transmitted in any form or by any means, without the prior written permission of the website admin, except in the case of brief quotations embodied in critical reviews and certain other noncommercial uses permitted by copyright law. For permission requests, write to the owner, addressed “Attention: Permissions Coordinator,” to the admin @coderinme

Leave a reply:

Your email address will not be published.