Bank Management System Suryadeep
Bank Management System Suryadeep
Project Report On
BANK MANAGEMENT SYSTEM using OOPS in C+
+
BRANCH: B.TECH, IT -2
INTRODUCTION
Bank Management System using Class in C+
+
In this program, we are using the concept of C++ class and object,
following basic operations are being performed here,
Opening an account
Show account info
Deposit
Withdraw
Search
Note: It's a basic program just for the practice of the concept of class and
object.
In this program, we have created a class Bank with the following member
functions,
OpenAccount() – It will take input account number, name and opening
balance.
ShowAccount() – It will display the account details such as account
number, name and balance.
Deposit() – It will ask for the amount to be added in available
balance, and deposit the amount.
Withdrawal() – It will ask for the amount to be withdrawn from the
available, will also check the available balance, if balance is
available, it will deduct the amount from the available balance.
Search() – It will search for the record and display the account info.
INPUT
#include <iostream>
using namespace std;
// class
class Bank {
private:
int acno;
char name[30];
long balance;
public:
void OpenAccount()
{
cout << "Enter Account Number: ";
cin >> acno;
cout << "Enter Name: ";
cin >> name;
cout << "Enter Balance: ";
cin >> balance;
}
void ShowAccount()
{
cout << "Account Number: " << acno << endl;
cout << "Name: " << name << endl;
cout << "Balance: " << balance << endl;
}
void Deposit()
{
long amt;
cout << "Enter Amount U want to deposit? ";
cin >> amt;
balance = balance + amt;
}
void Withdrawal()
{
long amt;
cout << "Enter Amount U want to withdraw? ";
cin >> amt;
if (amt <= balance)
balance = balance - amt;
else
cout << "Less Balance..." << endl;
}
int Search(int);
};
int Bank::Search(int a)
{
if (acno == a) {
ShowAccount();
return (1);
}
return (0);
}
// main code
int main()
{
Bank C[3];
do {
// display options
cout << "\n\n1:Display All\n2:By Account No\
n3:Deposit\n4:Withdraw\n5:Exit" << endl;
// user input
cout << "Please input your choice: ";
cin >> ch;
switch (ch) {
case 1: // displating account info
for (i = 0; i <= 2; i++) {
C[i].ShowAccount();
}
break;
case 2: // searching the record
cout << "Account Number? ";
cin >> a;
for (i = 0; i <= 2; i++) {
found = C[i].Search(a);
if (found)
break;
}
if (!found)
cout << "Record Not Found" << endl;
break;
case 3: // deposit operation
cout << "Account Number To Deposit
Amount? ";
cin >> a;
for (i = 0; i <= 2; i++) {
found = C[i].Search(a);
if (found) {
C[i].Deposit();
break;
}
}
if (!found)
cout << "Record Not Found" << endl;
break;
case 4: // withdraw operation
cout << "Account Number To Withdraw
Amount? ";
cin >> a;
for (i = 0; i <= 2; i++) {
found = C[i].Search(a);
if (found) {
C[i].Withdrawal();
break;
}
}
if (!found)
cout << "Record Not Found" << endl;
break;
case 5: // exit
cout << "Have a nice day" << endl;
break;
default:
cout << "Wrong Option" << endl;
}
} while (ch != 5);
return 0;
}
OUTPUT