COMPUTER SCIENCE
PROJECT FILE
ON
BANK MANAGEMENT
PROJECT PREPARED BY:
Aman Angirish
XII
Session: 2012-2013
AKS PUBLIC SCHOOL
TABLE OF CONTENTS
Certificate
Acknowledgement
Synopsis
Requirements
Coding
Output
Limitations
Bibliography
CERTIFICATE
This is to certify that Aman Angirish of class XII,
AKS Public School, New Delhi has successfully
completed his project in computer practicals for the
AISSCE as prescribed by CBSE in the year 2012-2013.
Date :
Registration No. :
Signature of Internal Signature of External
Examiner Examiner
__________________ __________________
Acknowledgement
I thank my Computer Science teacher Mr.
Jitender Negi for guidance and support. I
also thank my Principal Mrs. Aruna Sharma.
Finally, I would like to thank CBSE for
giving me this opportunity to undertake this
project.
SYNOPSIS
This is an automated software system written in C++
programming language for Bank Management which can
handle accounts for customers. It uses files to handle the
daily transactions, account management and user
management. It is not a complete accounting software that
is implemented in the banks, but still it can manage the
accounts of the customers using the files at back end.
User can add, edit and delete the customers and manage
their accounts. Program can create new bank accounts, list
all the accounts and show information about an individual
account.
It performs the following functions:
1. Create Individual Accounts
2. Manage existing Accounts
HEADER FILES USED AND
THEIR PURPOSE
1. FSTREAM.H – for file handling, cin and cout
2. CTYPE.H – for character handling
3. CONIO.H – for clrscr() and getch() functions
4. STDIO.H – for standard I/O operations
5. STDLIB.H – for general purpose function like atoi()
CODING
#include<fstream.h>
#include<ctype.h>
#include<conio.h>
#include<stdio.h>
#include<stdlib.h>
//***************************************************************
// CLASS USED IN PROJECT
//****************************************************************
class MyAccount
int acno;
char name[40];
int deposit;
char type;
public:
void New_Account(int); //function to get data from user
void Display_Account(); //function to show data on screen
void Modify_Rec(); //function to get new data from user
void Deposite_Amt(int); //function to accept amount and add to balance
amount
void Withdraw_Amt(int); //function to accept amount and subtract from
balance amount
void Show_Report(); //function to show data in tabular format
int ret_acno(); //function to return account number
int ret_deposit(); //function to return balance amount
char ret_type(); //function to return type of account
}; //class ends here
void MyAccount::New_Account(int ac)
acno = ac;
cout<<"\nAccount No. : "<<acno;
cout<<"\n\nEnter The Name of The account Holder : ";
gets(name);
do
cout<<"\nEnter Type of The account (C/S) : ";
cin>>type;
type=toupper(type);
if(type == 'C' || type == 'S')
break; // if type is valid exit this loop
else
cout<<"\n\n\tInvalid Type.\n";
while(1); // repeat until validation of type
do{
char dep[10];
cout<<"\nEnter The Initial amount(>=500 for Saving and >=1000 for
current ) : ";
gets(dep); // accept amount as a string
deposit = atoi(dep); // convert string into int
if( (type == 'C' && deposit >= 1000) || (type == 'S' && deposit
>= 500 ))
break; // if amount is valid exit this loop
else
cout<<"\n\n\tInvalid Amount\n";
while(1); // repeat until validation of amount
cout<<"\n\n\nAccount Created..";
void MyAccount::Display_Account()
cout<<"\nAccount No. : "<<acno;
cout<<"\nAccount Holder Name : ";
cout<<name;
cout<<"\nType of Account : "<<type;
cout<<"\nBalance amount : "<<deposit;
void MyAccount::Modify_Rec()
cout<<"\nThe account No."<<acno;
cout<<"\n\nEnter The Name of The account Holder : ";
gets(name);
do
cout<<"\nEnter Type of The account (C/S) : ";
cin>>type;
type=toupper(type);
if(type == 'C' || type == 'S')
break; // if type is valid exit this loop
else
cout<<"\n\n\tInvalid Type.\n";
while(1); // repeat until validation of type
do{
char dep[10];
cout<<"\nEnter The Initial amount(>=500 for Saving and >=1000 for
current ) : ";
gets(dep); // accept amount a string
deposit = atoi(dep); // convert string into int
if( (type == 'C' && deposit >= 1000) || (type == 'S' && deposit
>= 500 ))
break; // if amount is valid exit this loop
else
cout<<"\n\n\tInvalid Amount\n";
while(1); // repeat until validation of amount
void MyAccount::Deposit_Amt(int x)
deposit+=x;
void MyAccount::Withdraw_Amt(int x)
{
deposit-=x;
void MyAccount::Show_Report()
cout<<acno<<"\t\t"<<name<<"\t\t"<<type<<"\t"<<deposit<<endl;
int MyAccount::ret_acno()
return acno;
int MyAccount::ret_deposit()
return deposit;
char MyAccount::ret_type()
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 deposit/withdraw amount for
given account
void intro(); //introductory screen function
//***************************************************************
// THE MAIN FUNCTION OF PROGRAM
//****************************************************************
int main()
char ch;
char temp[10];
int num;
clrscr();
intro();
do
clrscr();
cout<<"\n\n\n\tMAIN MENU";
cout<<"\n\n\t1. NEW ACCOUNT";
cout<<"\n\n\t2. DEPOSIT AMOUNT";
cout<<"\n\n\t3. WITHDRAW AMOUNT";
cout<<"\n\n\t4. BALANCE ENQUIRY";
cout<<"\n\n\t5. ALL ACCOUNT HOLDER LIST";
cout<<"\n\n\t6. CLOSE AN ACCOUNT";
cout<<"\n\n\t7. MODIFY AN ACCOUNT";
cout<<"\n\n\t8. EXIT";
cout<<"\n\n\tSelect Your Option (1-8) ";
ch = getche();
switch(ch)
case '1':
clrscr();
cout<<"\n\tCreate New Account\n";
write_account();
break;
case '2':
clrscr();
cout<<"\n\n\t DEPOSIT AMOUNT";
cout<<"\n\n\tEnter The account No. : "; gets(temp); num =
atoi(temp);
deposit_withdraw(num, 1);
break;
case '3':
clrscr();
cout<<"\n\n\t WITHDRAW AMOUNT";
cout<<"\n\n\tEnter The account No. : "; gets(temp); num =
atoi(temp);
deposit_withdraw(num, 2);
break;
case '4':
clrscr();
cout<<"\n\n\t BALANCE ENQUIRY";
cout<<"\n\n\tEnter The account No. : "; gets(temp); num =
atoi(temp);
display_sp(num);
break;
case '5':
clrscr();
display_all();
break;
case '6':
clrscr();
cout<<"\n\n\t CLOSE AN ACCOUNT";
cout<<"\n\n\tEnter The account No. : "; gets(temp); num =
atoi(temp);
delete_account(num);
break;
case '7':
clrscr();
cout<<"\n\n\t MODIFY AN ACCOUNT";
cout<<"\n\n\tEnter The account No. : "; gets(temp); num =
atoi(temp);
modify_account(num);
break;
case '8':
clrscr();
cout<<"\n\n\tThanks for using Bank Management System";
break;
default :
cout<<"\n\n\tChoose a valid option\n\n\tPress any key to
continue...\n";
getch();
}while(ch!='8');
return 0;
}
//***************************************************************
// function to write in file
//****************************************************************
void write_account()
MyAccount ac;
fstream File;
File.open("account.dat", ios::binary|ios::in);
if(!File)
ac.New_Account(1000);
else{
while(File.read((char *) &ac, sizeof(MyAccount)));
ac.New_Account( (ac.ret_acno()+1) );
File.close();
//ofstream outFile;
File.open("account.dat",ios::binary|ios::app);
File.write((char *) &ac, sizeof(MyAccount));
File.close();
//***************************************************************
// function to read specific record from file
//****************************************************************
void display_sp(int n)
MyAccount ac;
int flag=0;
ifstream inFile;
inFile.open("account.dat",ios::binary);
if(!inFile)
cout<<"File could not be open !! Press any Key...";
return;
cout<<"\nBALANCE DETAILS\n";
while(inFile.read((char *) &ac, sizeof(MyAccount)))
if(ac.ret_acno()==n)
ac.Display_Account();
flag=1;
inFile.close();
if(flag==0)
cout<<"\n\nAccount number does not exist";
//***************************************************************
// function to modify record of file
//****************************************************************
void modify_account(int n)
int found=0;
MyAccount ac;
fstream File;
File.open("account.dat",ios::binary|ios::in|ios::out);
if(!File)
cout<<"File could not be open !! Press any Key...";
File.close();
return;
while(File.read((char *) &ac, sizeof(MyAccount)) && found==0)
if(ac.ret_acno()==n)
ac.Display_Account();
cout<<"\n\nEnter The New Details of account"<<endl;
ac.Modify_Rec();
int pos=(-1)*sizeof(MyAccount);
File.seekp(pos,ios::cur);
File.write((char *) &ac, sizeof(MyAccount));
cout<<"\n\n\t Record Updated";
found=1;
File.close();
if(found==0)
cout<<"\n\n Record Not Found ";
//***************************************************************
// function to delete record of file
//****************************************************************
void delete_account(int n)
MyAccount ac;
int flag=0;
ifstream inFile;
inFile.open("account.dat",ios::binary);
ofstream outFile;
outFile.open("Temp.dat",ios::binary);
if(!inFile)
cout<<"File could not be open !! Press any Key...";
return;
cout<<"\n\n";
while(inFile.read((char *) &ac, sizeof(MyAccount)))
if(ac.ret_acno()==n)
ac.Display_Account();
flag=1;
}
else
outFile.write((char *) &ac, sizeof(MyAccount));
if(flag==0)
cout<<"\n\nAccount number does not exist";
remove("Temp.dat");
return;
inFile.close();
outFile.close();
remove("account.dat");
rename("Temp.dat","account.dat");
cout<<"\n\n\tRecord Deleted ..";
//***************************************************************
// function to display all accounts deposit list
//****************************************************************
void display_all()
MyAccount ac;
ifstream inFile;
inFile.open("account.dat",ios::binary);
if(!inFile)
cout<<"File could not be open !! Press any Key...";
return;
cout<<"\n\n\t\tACCOUNT HOLDER LIST\n\n";
cout<<"====================================================\n";
cout<<"A/c no. NAME Type Balance\n";
cout<<"====================================================\n";
while(inFile.read((char *) &ac, sizeof(MyAccount)))
ac.Show_Report();
inFile.close();
//***************************************************************
// function to deposit and withdraw amounts
//****************************************************************
void deposit_withdraw(int n, int option)
int amt;
int found=0;
MyAccount ac;
fstream File;
File.open("account.dat", ios::binary|ios::in|ios::out);
if(!File)
cout<<"File could not be open !! Press any Key...";
File.close();
return;
}
while(File.read((char *) &ac, sizeof(MyAccount)) && found==0)
if(ac.ret_acno()==n)
ac.Display_Account();
if(option==1)
cout<<"\n\n\tTO DEPOSITE AMOUNT ";
cout<<"\n\nEnter The amount to be deposited : ";
cin>>amt;
ac.Deposite_Amt(amt);
if(option==2)
cout<<"\n\n\tTO WITHDRAW AMOUNT ";
cout<<"\n\nEnter The amount to be withdraw : ";
cin>>amt;
int bal=ac.ret_deposit()-amt;
if((bal<500 && ac.ret_type()=='S') || (bal<1000 &&
ac.ret_type()=='C'))
cout<<"\n\n\tInsufficient Balance";
return;
else
ac.Withdraw_Amt(amt);
int pos=(-1)* sizeof(ac);
File.seekp(pos,ios::cur);
File.write((char *) &ac, sizeof(MyAccount));
cout<<"\n\n\t Record Updated";
found=1;
File.close();
if(found==0)
cout<<"\n\n Record Not Found ";
//***************************************************************
// INTRODUCTION FUNCTION
//****************************************************************
void intro()
cout<<"\n\n\n\t BANK";
cout<<"\n\n\tMANAGEMENT";
cout<<"\n\n\t SYSTEM";
cout<<"\n\n\n\nMADE BY : Aman Angirish";
cout<<"\n\nSCHOOL : AKS PUBLIC SCHOOL";
cout<<"\n\nPress any key to continue...";
getch();
REQUIREMENTS
HARDWARE REQUIRED
Printer, to print the required
documents of the project
Compact Drive
Processor : Pentium III
Ram : 64 MB
Harddisk : 20 Gb
SOFTWARE REQUIRED
Operating system : Windows XP
Turbo C++, for execution of program
Ms word, for presentation of output.
www.cbseportal.com
www.cbseportal.com
www.cbseportal.com
www.cbseportal.com
www.cbseportal.com
www.cbseportal.com
BIBLIOGRAPHY
Sumita Arora – Computer Science with C++
E. Balagurusami – C++
Robert Lafore – Turbo C++
www.extramarks.com