Vous êtes sur la page 1sur 35

BANK MANAGEMENT SYSTEM

Name – Om Jaiswal
Class – XII
AISSCE Roll number –

i
Computer Science Project(083)
Project name – Bank Management System

In partial fulfilment of AISSCE 2020


Submitted by :
Name – Om Jaiswal
Class – XII
AISSCE Roll number –
DAV Model School, IIT Kharagpur

ii
Certificate

This is to certify that the project entitled “Bank


Management System” is a bonafide record of
the work carried out by “Om Jaiswal” of class
XII and AISSCE roll number under my
supervision and guidance.

____________________ ________________
Swarup Kumar Maity Lopa Chatterjee
Computer Science Teacher Principal

____________________
External Examiner

iii
Acknowledgement

I was able to complete my project “Bank


Management System” in the given time limit
and with upmost perfection with the help,
guidance and support of my parents, friends
and my Computer Science teacher Mr. Swarup
Kumar Maity. I also solemnly thank our
honourable Principal Madam Mrs. Lopa
Chatterjee for providing the necessary
facilities and infrastructure required to
complete my project.

DAV Model School, Om Jaiswal


IIT Kharagpur

iv
Contents
 Cover page i
 Title ii
 Certificate iii
 Acknowledgement iv
 Contents v
 Introduction 1
 Program logic 2
 Program code 4
 Output 17
 Variable description 26
 Function description 26
 Object description 27
 Class description 28
 Utility of the project 29
 Bibliography 30

v
Introduction
The Bank Management System is a completely C++ oriented
database system. The actual transactions being held in a bank,
has been transformed into a completely digitized form.
Without the use of any graphics, the program is command
driven one where the user needs to read the commands and
operate the transactions.
The Bank Management System provides the user with couple
of account options. As per user’s choice, the user is allowed to
deposit or withdraw money from the bank. All these
transactions can be made at any point of time, as and when
required.
This is just a basic database system for a bank offering the
basic transaction facilities. Being the dummy of any realistic
bank system, it serves the purpose of handling a bank at the
grass root level.

1
Program Logic
The program declares a class account with 4 private data
members to store the details of an account and 9 member
functions(outline). The function create_account() gets the data
from the user and show_account() displays all those details.
The function modify() accepts the new details for an account
from the user. Functions dep(int) and draw(int) accept the
amount to be deposited or withdrawn respectively. The
function report() displays the list of all the account holder
along with their account details in a tabular format. Functions
retacno(),retdeposit() and retype() are accessors which return
account number, balance amount and type of account
respectively.
Besides these member functions there are also 7 other public
functions to carry out all the above mentioned operations on a
datafile which keeps track of all the records and details
pertaining to each account holder. The function
write_account() writes a record to the binary file while the
function display_sp(int) reads a record from the binary file and
displays it. Functions modify_account(int) and
delete_account(int) modify and delete records from the file
respectively.The function deposit_withdraw(int,int) updates
the balance amount in the file as per user’s requirements.
There is also an introductory function intro() which display the
details of the developers on the screen.

2
The main() function execute intro() first and then displays a
menu and calls the respective functions as and when required
as per the user’s choice. It drives the control of the entire
program until termination.

3
Program Code
//****************************************************************

// HEADER FILE USED IN PROJECT

//****************************************************************

#include<fstream.h>

#include<ctype.h>

#include<iomanip.h>

#include<conio.h>

#include<stdio.h>

//****************************************************************

// CLASS USED IN PROJECT

//****************************************************************

class account

int acno;

char name[50];

int deposit;

char type;

public:

void create_account(); //function to get data from user

void show_account(); //function to show data on screen

void modify(); //function to get new data from user

void dep(int); //function to accept amount and add to balance amount

void draw(int); //function to accept amount and subtract from balance amount

void report(); //function to show data in tabular format

int retacno(); //function to return account number

int retdeposit(); //function to return balance amount

char rettype(); //function to return type of account


}; //class ends here

void account::create_account()

cout<<"\nEnter the account no. : ";

cin>>acno;

cout<<"Enter name of the account holder : ";

gets(name);

cout<<"Enter the type of account (C/S) : ";

cin>>type;

type=toupper(type);

cout<<"Enter initial amount(>=500 for Savings and >=1000 for Current) : ";

cin>>deposit;

cout<<"\n\nAccount created!";

void account::show_account()

cout<<"\nAccount holder name : ";

cout<<name;

cout<<"\nType of account : "<<type;

cout<<"\nBalance amount : "<<deposit;

void account::modify()

cout<<"\n\nAccount holder name : ";

gets(name);

cout<<"Type of account(C/S) : ";


5
cin>>type;

type=toupper(type);

cout<<"Balance amount : ";

cin>>deposit;

void account::dep(int amt)

deposit+=amt;

void account::draw(int amt)

deposit-=amt;

void account::report()

cout<<acno<<"\t\t"<<name<<"\t\t "<<type<<"\t "<<deposit<<endl;

int account::retacno()

return acno;

int account::retdeposit()

return deposit;
6
}

char account::rettype()

return type;

//****************************************************************

// FUNCTION DECLARATION

//****************************************************************

void write_account(); //function to write record in binary file

void display_sp(int); //function to display account details given by user

void modify_account(int); //function to modify record of file

void delete_account(int); //function to delete record of file

void display_all(); //function to display all account details

void deposit_withdraw(int, int); // function to desposit/withdraw amount for given account

void intro(); //introductory screen function

//****************************************************************

// THE MAIN FUNCTION OF PROGRAM

//****************************************************************

int main()

char ch;

int num;

clrscr();

intro();

do

clrscr();

cout<<"\n\n\n\t------- MAIN MENU -------";


7
cout<<"\n\n\t1. CREATE NEW ACCOUNT";

cout<<"\n\n\t2. CASH DEPOSIT";

cout<<"\n\n\t3. CASH WITHDRAW";

cout<<"\n\n\t4. BALANCE ENQUIRY";

cout<<"\n\n\t5. ALL ACCOUNT HOLDERS' LIST";

cout<<"\n\n\t6. MODIFY ACCOUNT";

cout<<"\n\n\t7. CLOSE AN ACCOUNT";

cout<<"\n\n\t8. EXIT";

cout<<"\n\n\tEnter your choice(1-8) : ";

cin>>ch;

clrscr();

switch(ch)

case '1':

write_account();

break;

case '2':

cout<<"\n\n\tEnter the account no. : "; cin>>num;

deposit_withdraw(num, 1);

break;

case '3':

cout<<"\n\n\tEnter the account no. : "; cin>>num;

deposit_withdraw(num, 2);

break;

case '4':

cout<<"\n\n\tEnter the account no. : "; cin>>num;

display_sp(num);

break;

case '5':
8
display_all();

break;

case '6':

cout<<"\n\n\tEnter the account no. : "; cin>>num;

modify_account(num);

break;

case '7':

cout<<"\n\n\tEnter the account no. : "; cin>>num;

delete_account(num);

break;

case '8':

cout<<"\n\n\n\n\n\n\n\n\n\t\t Thank you for using our bank management system";

cout<<"\n\n\t\t\t We were happy to help you!";

break;

default :

cout<<"\n\n\tInvalid choice!\n\n\tPress any key to continue...”;

getch();

}while(ch!='8');

return 0;

//****************************************************************

// FUNCTION TO WRITE INTO FILE

//****************************************************************

void write_account()

account ac;

ofstream outFile;

outFile.open("account.dat",ios::binary|ios::app);
9
ac.create_account();

outFile.write((char *) &ac, sizeof(account));

outFile.close();

//****************************************************************

// FUNCTION TO READ A SPECIFIC RECORD FROM FILE

//****************************************************************

void display_sp(int num)

account ac;

int found=0;

ifstream inFile;

inFile.open("account.dat",ios::binary);

if(!inFile)

cout<<"File not found! Press any key to continue...";

return;

while(inFile.read((char *) &ac, sizeof(account)))

if(ac.retacno()==num)

ac.show_account();

found=1;

inFile.close();

if(found==0)

cout<<"\n\n\tAccount number does not exist...";


10
}

//****************************************************************

// FUNCTION TO MODIFY A RECORD IN FILE

//****************************************************************

void modify_account(int num)

int found=0;

account ac;

fstream File;

File.open("account.dat",ios::binary|ios::in|ios::out);

if(!File)

cout<<"File not found! Press any key to continue...";

return;

while(File.read((char *) &ac, sizeof(account)) && found==0)

if(ac.retacno()==num)

ac.show_account();

cout<<"\n\nEnter the new details for account no."<<ac.retacno();

ac.modify();

int pos=(-1)*sizeof(account);

File.seekp(pos,ios::cur);

File.write((char *) &ac, sizeof(account));

cout<<"\n\n\t Account details updated!";

found=1;

}
11
File.close();

if(found==0)

cout<<"\n\n\tAccount number does not exist...";

//****************************************************************

// FUNCTION TO DELETE RECORD OF FILE

//****************************************************************

void delete_account(int num)

int found==1;

account ac;

ifstream inFile;

ofstream outFile;

inFile.open("account.dat",ios::binary);

if(!inFile)

cout<<"File not found! Press any key to continue...";

return;

outFile.open("Temp.dat",ios::binary);

inFile.seekg(0,ios::beg);

while(inFile.read((char *) &ac, sizeof(account)))

if(ac.retacno()!=num)

outFile.write((char *) &ac, sizeof(account));

else

found==0;
12
}

inFile.close();

outFile.close();

remove("account.dat");

rename("Temp.dat","account.dat");

if(found==0)

cout<<"\n\n\tAccount closed.";

else

cout<<”\n\n\tAccount number does not exist...”;

//****************************************************************

// FUNCTION TO DISPLAY ALL ACCOUNT HOLDERS’ LIST

//****************************************************************

void display_all()

account ac;

ifstream inFile;

inFile.open("account.dat",ios::binary);

if(!inFile)

cout<<"File not found! Press any key to continue...";

return;

cout<<"\n\n\t ACCOUNT HOLDERS' LIST\n\n";

cout<<"====================================================\n";

cout<<"A/c no.\t\tHolder\t\tType\t Balance\n";

cout<<"====================================================\n";

while(inFile.read((char *) &ac, sizeof(account)))

{
13
ac.report();

inFile.close();

//****************************************************************

// FUNCTION TO DEPOSIT AND WITHDRAW CASH

//****************************************************************

void deposit_withdraw(int num, int option)

int amt;

int found=0;

account ac;

fstream File;

File.open("account.dat", ios::binary|ios::in|ios::out);

if(!File)

cout<<"File not found! Press any key to continue...";

return;

while(File.read((char *) &ac, sizeof(account)) && found==0)

if(ac.retacno()==num)

ac.show_account();

if(option==1)

cout<<"\n\n ----------------------------- ";

cout<<"\n\nEnter the amount to be deposited : ";

cin>>amt;
14
ac.dep(amt);

if(option==2)

cout<<"\n\n ----------------------------- ";

cout<<"\n\nEnter the amount to be withdrawn : ";

cin>>amt;

int bal=ac.retdeposit()-amt;

if((bal<500 && ac.rettype()=='S') || (bal<1000 && ac.rettype()=='C'))

cout<<"Insufficient balance...";

else

ac.draw(amt);

int pos=(-1)* sizeof(ac);

File.seekp(pos,ios::cur);

File.write((char *) &ac, sizeof(account));

cout<<"\n\n\t Balance Updated!";

found=1;

File.close();

if(found==0)

cout<<"\n\n\tAccount number does not exist...";

//****************************************************************

// INTRODUCTORY FUNCTION

//****************************************************************

void intro()

{
15
cout<<"\n\n\n\n\n\n\t\t\t\t BANK";

cout<<"\n\n\t\t\t\t MANAGEMENT";

cout<<"\n\n\t\t\t\t SYSTEM";

cout<<"\n\n\n\n\t\tDEVELOPED BY : OM JAISWAL and SIDDHARTH CHATTERJEE";

getch();

//***************************************************************

// END OF PROJECT

//***************************************************************

16
Output

17
18
19
20
21
22
23
24
25
Variable Description
Variable Data
Purpose
Name Type
acno,num int To store account number of an account
name char To store name of account holder
deposit int To store initial balance amount
type char To store the type o account
To store amount to be deposited or
amt int
withdrawn
To store user’s choice for the menu
ch char
displayed
found int Flag variable
Formal parameter to store choice for
option int
either deposition or withdrawal
pos int File pointer

Function Description
Function Return
Description
Name Type
To get details of an account
create_account() void
from the user
To display the details of
show_account() void
account
To get new details for an
modify() void
account from the user
To deposit cash into an
dep(int) void
account
To withdraw cash from an
draw(int) void
account
To display details of all
report() void
account holders
retacno() int To return account number
To return balance amount
retdeposit() int
of an account
retype() char To return account type(C/S)
To add records into a
write_account() void
binary file
To read account details
display_sp(int) void
from file
To modify records in the
modify_account(int) void
datafile
To delete a record from the
delete_account(int) void
file
To display details of all
display_all() void
account holders
To deposit or withdraw
deposit_withdraw(int,int) void cash from an account as per
command
To display details about the
intro() void
developers

Object Description
Object
Type Description
Name
The object invoking all member functions of
ac account
class account
Object to add records into a binary file
outFile ofstream
account.dat
Object to read records from the same binary
inFile ifstream
file
File fstream Object to modify records in the datafile

27
Class Description
Class name Description
A class containing data members and member
account functions to carry out all the operations
pertaining to a bank management system

28
Utility of the Project

The C++ program on Bank Management System is extremely


user friendly and handy to access. It enables us to get a very
clean idea about banking at the grass root level. Creating the
program was fun and a great learning experience. Concepts of
object oriented programming and data file handling were
sharpened and better understood.
Hence, the program can be used by any layman user without
having any difficulties, thus serving its purpose.
All in all it was a great learning experience, not only in the
context of academics but also on a social level, as the entire
process o banking transactions were posed as a clear picture
in front of us. Doing so in a group of two also alleviated our life
skills.

29
Bibliography

The sources used for extensive help were :


1. Computer Science with C++(Sumita Arora)
Textbook Class XII

30

Vous aimerez peut-être aussi